Next-Gen App & Browser Testing Cloud
Trusted by 2 Mn+ QAs & Devs to accelerate their release cycles

Updated November 30, 2026 · Written and reviewed under our editorial policy
To clone a Git repository, copy its URL (on GitHub: the green Code button), open a terminal in the folder where you want it, and run git clone <url>. Git creates a new folder named after the repository. Add a folder name after the URL to choose the name, or --depth 1 to download only the latest commit.
To clone a repository from the command line:
git --version.cd to the parent folder.git clone https://github.com/owner/repo.git.cd repo to start working.Source: Git documentation, "git-clone" (git-scm.com/docs/git-clone), checked 2026-11-28.
If git --version prints an error instead of a version number, install Git before you start.

A Git repository can be cloned over HTTPS or over SSH, and GitHub shows both URLs under the green Code button. Both download the same files; the difference is how you sign in to a private repository and when you push.
https://github.com/owner/repo.git): needs no setup for a public repository. For a private repository or a push, Git asks for credentials; on GitHub that's a personal access token, which a credential helper can store for you.git@github.com:owner/repo.git): needs an SSH key on your computer, with its public key added to your GitHub account. After that, Git doesn't ask for your GitHub password (it may ask for your key's passphrase unless ssh-agent or Keychain stores it). Test the setup with ssh -T git@github.com.Pick HTTPS if you only need to read the code, or if your network blocks SSH. Pick SSH if you push often from your own computer. Any terminal works for this; we compared the best terminal apps for Mac.
Cloned a project and want to know if it still works? Kane CLI runs end-to-end tests from your terminal and works alongside Claude Code, Cursor, Codex and Gemini CLI. Use it to run end-to-end tests on the repo you just cloned.

By default, git clone creates a folder named after the repository, so cloning owner/repo.git gives you a folder called repo. To choose the folder name, add it after the URL:
git clone https://github.com/owner/repo.git my-folderTo clone into the folder you're already in, use a dot as the folder name: git clone <url> .. Git only clones into a folder that doesn't exist yet or is empty, so this works in a new, empty folder.
If the repository has no ignore rules yet, generate a .gitignore file so build output and local secrets stay out of your commits. Once the folder exists, you can run the project's Python scripts from it.
To clone one branch of a Git repository, name it with --branch and add --single-branch:
git clone --branch dev --single-branch https://github.com/owner/repo.gitOn its own, --branch still downloads every branch; it only changes which one is checked out after the clone. --single-branch fetches just that branch's history, which saves time on repositories with many long-lived branches. --branch also accepts a tag, such as a release tag.
To add another branch to a single-branch clone later, run git remote set-branches --add origin other-branch, then git fetch origin other-branch. Branches you no longer need can be deleted locally and on the remote.
A shallow clone downloads only the most recent commits of a Git repository instead of its full history. --depth 1 fetches just the latest commit:
git clone --depth 1 https://github.com/owner/repo.git--depth implies --single-branch, so you get only the default branch, or the one you name with --branch. That makes a shallow clone a good fit for CI jobs and for a quick look at a large repository. The trade-offs:
git log and git blame stop at the cut-off, so you can't see older changes.git fetch --unshallow to download the rest of the history.Cloning a private Git repository uses the same git clone command, but Git has to prove you have access. You have two options:
git clone asks for a password, paste the token. Git for Windows includes Git Credential Manager, which can sign you in through the browser and store the credentials instead.ssh-keygen -t ed25519 -C "you@example.com", add the contents of the new .pub file on GitHub under Settings > SSH and GPG keys, then clone with the SSH URL.Never paste a token into a URL you share. A URL such as https://<token>@github.com/owner/repo.git is saved in your shell history and in the clone's .git/config file, where anyone who reads it can use the token.
VS Code and GitHub Desktop can both clone a Git repository without typing commands. VS Code uses the Git installed on your computer; GitHub Desktop comes with its own.
Both tools also list the repository's branches, so you can switch, create or delete a Git branch without the command line.
Most failed Git clones come down to one of these errors:
git clone <url> repo-2), rename or delete the old folder, or, if it's already a clone of the same repository, cd into it and run git pull.ssh -T git@github.com to test, check that your public key is added to your account, or clone with the HTTPS URL instead.If git isn't recognized, install Git on your computer first. To check how well you know clones, remotes and branches, work through our Git interview questions.
git clone copies a repository and its history into a new folder on your computer. It also sets up a remote named origin, so you can pull new commits and push your own later.
Run git clone --branch <name> --single-branch <url>. --branch checks out that branch after the clone, and --single-branch skips downloading the other branches.
No. git clone makes a new copy of a repository, once. git pull updates a copy you already have with the new commits from the remote.
Run git clone <url> . with a dot at the end. The current folder must be empty, or Git refuses to clone into it.
The repository is private, or the URL points to one your account can't see, so GitHub asks you to sign in. GitHub doesn't accept your account password for Git over HTTPS: enter a personal access token, sign in through Git Credential Manager, or clone with an SSH URL and a key instead.
KaneAI - Testing Assistant
World’s first AI-Native E2E testing agent.

TestMu AI forEnterprise
Get access to solutions built on Enterprise
grade security, privacy, & compliance