This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Download Microsoft Edge
More info about Internet Explorer and Microsoft Edge
In this article
Azure DevOps Services | Azure DevOps Server 2022 - Azure DevOps Server 2019
Visual Studio 2019 | Visual Studio 2022
You can create a local copy of a remote Git repo by cloning it into a local folder on your computer. Cloning a remote repo downloads all
commits
on all
branches
of the repo, unless you use the
--single-branch
clone option. Cloning links each branch in your new local repo with the corresponding branch in the remote repo. That way, when you
push
to share your local branch changes with your team, the corresponding remote branch is updated. Similarly, when you
pull
to update your local branch with changes made by your team, updates from the corresponding remote branch are retrieved. The remote repo can be an
Azure Repos
Git repo, a
GitHub
repo, or other hosted Git repo.
This article provides procedures for the following tasks:
Get the clone URL for an
Azure Repos
Git repo
Get the clone URL for a
GitHub
repo
Clone an
Azure Repos
Git repo
Clone a
GitHub
repo
Clone any Git repo
Open a Visual Studio solution from a cloned repo
For an overview of the Git workflow, see
Azure Repos Git tutorial
.
Prerequisites for access to Azure Repos
Repos
must be enabled in your Azure DevOps project settings. If the
Repos
hub and associated pages don't display, see
Turn an Azure DevOps service on or off
to reenable
Repos
.
To view code in private projects, you must be a member of an Azure DevOps project with
Basic
access level or higher. For public projects, everyone can view the code.
If you don't have a project, create one or
sign up for free
.
If you aren't a project member,
get added
.
To clone or contribute to code for a private project, you must be a member of the
Contributors
security group or have the corresponding permissions set. For public projects, anyone can clone and contribute code. For more information, see
What is a public project?
For public projects, users granted
Stakeholder
access have full access to
Azure Repos
.
Repos
must be enabled in your Azure DevOps project settings. If the
Repos
hub and associated pages don't display, see
Turn an Azure DevOps service on or off
to reenable
Repos
.
To view code, you must be a member of the Azure DevOps project with
Basic
access or higher. If you aren't a project member,
get added
.
To clone or contribute to code, you must be a member of the
Contributors
security group, or have the corresponding permissions, in the project you want to change.
Get the clone URL of an
Azure Repos
Git repo
Typically, you need to know the clone URL of the remote repo that you want to clone. The clone URL uniquely identifies the remote repo.
When you're signed into an Azure DevOps project, Visual Studio supports searching for and cloning project repos without needing to know the clone URL.
From your web browser, open the team project for your Azure DevOps organization, and then choose
Repos
>
Files
to open the
Files
view.
With Azure DevOps Services, the format for the project URL is
dev.azure.com/{your organization}/{your project}
. However, the previous format that references the
visualstudio.com
format is still supported. For more information, see
Introducing Azure DevOps, Switch existing organizations to use the new domain name URL
.
Get the clone URL of a
GitHub
repo
Typically, you need to know the clone URL of the remote repo that you want to clone. The clone URL uniquely identifies the remote repo.
When you're signed into
GitHub
, Visual Studio supports searching for and cloning GitHub repos without needing to know the clone URL.
Open a browser and navigate to your
GitHub
account, select the
Repositories
tab, and choose the repository to clone.
Clone an Azure Repos Git repo
By signing in as a member of an Azure DevOps project, you can clone private repos that are accessible to you, and public repos. Visual Studio supports search, clone, and sync operations on repos that are accessible through authentication.
You can clone a public
Azure Repos
Git repo without signing in as a member of its parent Azure DevOps project. To clone a public Git repo without signing in, see
Clone any Git repo
and then connect to a project in Azure DevOps.
Visual Studio 2022 provides a Git version control experience by using the
Git
menu,
Git Changes
, and through context menus in
Solution Explorer
. Visual Studio 2019 version 16.8 also offers the
Team Explorer
Git user interface. For more information, see the
Visual Studio 2019 - Team Explorer
tab.
From the
Git
menu on the menu bar, choose
Clone Repository
to open the
Clone a repository
window.
In the
Connect to a Project
window, sign in to Azure DevOps and choose the remote repo you want to clone. You can use the search box to filter the list of remote repos. If you don't see the remote repo, select
Add Azure DevOps Server
to add the server that hosts the repo. Verify the local folder path where you want the local clone to be created, and then select
Clone
.
Visual Studio 2019 provides a Git version control experience by using the
Git
menu,
Git Changes
, and through context menus in
Solution Explorer
.
From the
Git
menu on the menu bar, choose
Clone Repository
to open the
Clone a repository
window.
In the
Connect to a Project
window, sign in to Azure DevOps and choose the remote repo you want to clone. You can use the search box to filter the list of remote repos. If you don't see the remote repo, select
Add Azure DevOps Server
to add the server that hosts the repo. Verify the local folder path where you want the local clone to be created, and then select
Clone
.
Visual Studio 2019 version 16.8 and later versions provides a Git version control experience while maintaining the
Team Explorer
Git user interface. To use
Team Explorer
, uncheck
Tools
>
Options
>
Preview Features
>
New Git user experience
from the menu bar. You can use Git features from either interface interchangeably.
In
Team Explorer
, select
Connect
to open the
Connect
page, and then choose
Manage Connections
>
Connect to Project
.
In the
Connect to a Project
window, sign in to Azure DevOps and choose the remote repo you want to clone. You can use the search box to filter the list of remote repos. If you don't see the remote repo, select
Add Azure DevOps Server
to add the server that hosts the repo. Verify the local folder path where you want the local clone to be created, and then select
Clone
.
Clone a GitHub repo
By signing into
GitHub
or using SSH authentication, you can clone private repos that are accessible to you, and public repos. Visual Studio supports search, clone, and sync operations on repos that are accessible through authentication.
You can clone a public
GitHub
repo without signing in to GitHub or otherwise authenticating. To clone a public Git repo without signing in, see
Clone any Git repo
.
If you haven't already,
download and install Git
. Enable
Git Credential Manager
when prompted during the install, or
configure SSH authentication
.
At the command prompt, run the Git clone command with the
clone URL
of the remote repo. This command will create a local clone repo under the current folder.
git clone <clone URL>
The Git clone command also let's you specify a folder path after the clone URL to create the repo in a specific location. For example:
git clone https://fiber-teams@dev.azure.com/fiber-teams/FiberTests/_git/FiberTests C:\Repos\FiberTests
The Git clone command also let's you clone just a single branch. This option is useful when only one branch of a large repo is of interest to you.
git clone <clone URL> --branch <branch name> --single-branch
When you clone a remote repository, Git assigns the alias origin
as shorthand for the URL of the remote repo you cloned. Git commands often use that alias.
Open a Visual Studio solution from a cloned repo
Visual Studio 2022
Visual Studio 2019 - Git menu
Visual Studio 2019 - Team Explorer
Git Command Line
At the command prompt, run the following command to open a Visual Studio solution from a cloned repo. This command isn't a Git command.
start <solution filepath>
For example:
start C:\Repos\FiberTests\FiberTests.sln
Next steps
Save work with commits
Related articles
New to Git repos? Learn more