Clone an existing Git repo

Azure Repos | Azure DevOps Server 2019 | TFS 2018 | TFS 2017 | TFS 2015 | VS 2017 | VS 2015

Create a complete local copy of an existing Git repo by cloning it. Cloning a repo downloads all commits and branches in the repo and sets up a named relationship with the existing repo you cloned. Use this relationship to interact with the existing repo, pushing and pulling changes to share code with your team.


By default, Git will assign the origin to the remote repo you clone from. Most users don't need more than one remote, so the tutorial uses origin in its steps. Learn more about setting up remotes to your Git repo.

In this tutorial you learn how to:

  • Get the clone URL to your repo
  • Clone a repo

Video tutorial


Working from the command line? You can view our video overview using command line steps on Channel9.

Get the clone URL to your repo

Before you can clone an existing repo, you'll need a URL that points to the existing repo. This URL represents the source of the repo you're going to copy during the clone.

If you're using Azure DevOps Services or Team Foundation Server 2017, you can find this clone URL in the web portal.

  1. From your web browser, open the team project for your Azure DevOps organization and choose Repos, Files.

    Repos files

  2. Select Clone in the upper right.

    Get a clone a URL from Azure Repos

If you need to clone a GitHub repo, you'll need to get the clone URL from the Clone or download button while viewing the repo on the web in GitHub.

Other Git providers have similar buttons in their user interface to get the clone URL.

Copy this URL into the clipboard or store it in a place where you can find it easily. You can't clone a repo without a clone URL.

Clone a repo

Clone from Azure DevOps Services / Team Foundation Server

  1. In Team Explorer, open up the Connect page by selecting the Connect icon, and then choose Manage Connections, Connect to Project.

    Cloning Azure DevOps Services Git repositories in Visual Studio

  2. On the Connect to a Project dialog, select the repo you want to clone from the list and select Clone. If you don't see your repo listed, you can filter the list to find it or add a Team Foundation Server where the repo is hosted by selecting the Add TFS Server link.

    Cloning a Git Repository from a connected Azure DevOps organization


    Project URLs have changed with the release of Azure DevOps Services and now have the format{your organization}/{your project}, but you can still use the existing format. For more information, see VSTS is now Azure DevOps Services.

  3. Verify the location of the cloned repo on your PC and select Clone.

Clone from another Git provider

If you are not using Azure Repos, you can still clone your repo in Team Explorer and work with your code in Visual Studio.

  1. In Team Explorer, open the Connect view.

  2. Select Clone under Local Git Repositories and enter the URL for your Git repo—this will be provided by your team or Git hosting provider.

  3. Select a folder where you want your cloned repo to be kept.

  4. Select Clone to clone the repo.

    Clone your repo from other providers using Visual Studio

Open a solution in Visual Studio from a cloned repo

  1. Open a solution in a cloned repo in Visual Studio by right-clicking on the repository in the Team Explorer Connect view and selecting Open.

    Open a solution from a cloned repo in Team Explorer

  2. You'll be taken to the Home view in Team Explorer. Double-click your project solution file in the Solutions area to open the solution in Solution Explorer.

    Open a solution from a cloned repo in Team Explorer

Next steps