Cloning downloads a copy of a GitHub repository to your machine. VS Code lets you clone from a URL or browse your repositories directly, without opening a terminal.
This works for public and private repositories on GitHub, and for repositories hosted on GitLab, Bitbucket, Azure DevOps, or any self-hosted Git server. After cloning, VS Code offers to open the project immediately so you can start working right away.
Before cloning, make sure Git is installed and you are signed in to GitHub. If you have not done that yet, start with /vscode/how-to-set-up-git-in-vs-code-and-configure-your-name-and-email and /vscode/how-to-sign-in-to-github-from-vs-code.
Clone a repository
There are two ways to start cloning. Both lead to the same flow.
Method 1: Command Palette
Open the Command Palette (Ctrl+Shift+P / Cmd+Shift+P) and type Git: Clone. Press Enter.
Method 2: Source Control view
Open the Source Control view (Ctrl+Shift+G on Windows/Linux, or click the branch icon in the Activity Bar). If no folder is open, the view shows a Clone Repository button. Select it.
Choose Clone from GitHub or Clone from URL
After triggering the clone command, pick one of two options.
Clone from GitHub shows your repositories after sign-in. Type to filter and select one.
Clone from URL is for pasting any Git URL.
Use it for public repos or repos from GitLab, Bitbucket, and other hosts.
Pick a local folder
VS Code opens a folder picker. Navigate to the parent folder where you want the repository stored. VS Code creates a new subfolder named after the repository inside the folder you select.
Open the cloned repository
After cloning finishes, a notification appears in the bottom-right corner: "Would you like to open the cloned repository?" Select Open to open it in the current window, or Open in New Window to keep your current workspace.
When you open a cloned repository for the first time, VS Code shows the Workspace Trust dialog. Only trust repositories from sources you know. Untrusted workspaces run in Restricted Mode, which disables tasks, debugging, and terminal access. Learn more about Workspace Trust and Restricted Mode in the VS Code documentation.
What happens after cloning
Once the repository opens, VS Code sets up everything automatically.
- The File Explorer shows the repository contents in the sidebar.
- The Source Control view activates and shows the current branch.
- The Status Bar displays the branch name in the bottom-left corner.
- Git creates a remote named origin pointing to the URL you cloned from.
You can now edit files, stage and commit changes, and push them back to GitHub. Read /vscode/how-to-stage-commit-push-and-pull-changes-in-vs-code for the full commit workflow.
If you want to try out a new feature or fix a bug, create a dedicated branch so your work stays separate from the main codebase.
Clone a repository by pasting a URL
If you already have a repository URL copied, the fastest path is to open the Command Palette, run Git: Clone, paste the URL, pick a folder, and select Open when prompted.
This works for any Git repository URL: GitHub, GitLab, Bitbucket, Azure DevOps, or a self-hosted server. Public repositories do not require sign-in. For private repositories, make sure you are authenticated first.
If you use SSH instead of HTTPS, confirm your SSH key is added to your GitHub account and loaded in your SSH agent. VS Code detects your SSH configuration and uses it automatically when you clone via an SSH URL.
Troubleshoot common clone problems
| Problem | Fix |
|---|---|
| "Repository not found" | Check that the URL is correct and that you have access. For private repos, make sure you are signed in to GitHub. |
| Authentication fails | Run GitHub: Sign In from the Command Palette to refresh your session. If you use SSH, verify your key is added to GitHub and loaded in your SSH agent (ssh-add -l). |
| Clone is slow or times out | Large repositories take longer. Try cloning with --depth 1 via the terminal for a shallow clone. |
| VS Code does not recognize the cloned folder as a Git repo | The .git folder might be missing. Re-clone or open the correct parent folder. |
After cloning, create a dedicated branch for your work to keep changes separate from the main codebase.
Rune AI
Key Insights
- Use Git: Clone from the Command Palette or the Clone Repository button in the Source Control view.
- Sign in to GitHub to browse your private repositories; paste the URL directly for public repos.
- Pick any local parent folder. VS Code creates a subfolder named after the repository.
- After cloning, VS Code asks whether to open the project in the current window or a new one.
- Review the Workspace Trust prompt before opening an unfamiliar repository.
Frequently Asked Questions
Can I clone a repository without signing in to GitHub?
Where does VS Code save cloned repositories?
Can I clone a specific branch instead of the default branch?
What if cloning fails with an authentication error?
Conclusion
Cloning a repository in VS Code takes three steps: trigger the clone command, pick the repository, and choose a local folder. VS Code offers to open the cloned project immediately so you can start working right away.
More in this topic
How to Use VS Code with WSL 2 on Windows
Run VS Code connected to Windows Subsystem for Linux so you can develop in a full Linux environment with native tools, terminals, and debugging, all from Windows.
20 Best VS Code Extensions for Web Developers in 2026
Twenty carefully chosen VS Code extensions every web developer should know. Covers formatting, linting, frameworks, debugging, Git, and developer experience.
How to Install, Disable, Update, and Uninstall VS Code Extensions
Learn how to install, disable, update, and uninstall VS Code extensions from the Marketplace and the command line. Step-by-step instructions for every action.