10 Steps to move a Git repo from GitHub to Visual Studio Team Services

Visual Studio Team Services is Microsoft’s cloud version of Team Foundation Server.  By being hosted in Azure, it provides additional functionality and is typically ahead of TFS when it comes to features since new updates are deployed to VSTS every 3 weeks.


One of the great features of Visual Studio Team Services (VSTS) is that it allows you to host unlimited private Git repos.  VSTS offers you up to 5 free users and if you already have an MSDN subscription, you also get in for free and you don’t count towards those 5 users.

The distributed nature of Git is that you are able to easily move repositories around since each repo contains all files and history.  So moving a Git repo that is hosted in GitHub to VSTS is relatively simple.  Here is a list of steps that you should follow to make the move:

1 – Browse to your Git repo on the GitHub website.  On the top right of the Repo homepage, you are going to see the the Clone URL for the repo:

2- Copy the Clone URL

3 – Open Visual Studio 2015, go to Team Explorer, and click on the “Manage Connections” icon:

4 – Scroll towards the bottom, and you are going to see a “Local Repositories” section.  Click on the “Clone” link:

5 – Enter the Clone URL that you copied from GitHub, select the correct local path, and then click on “Clone”.  This will bring down all files and history from your GitHub repo.

6 – Now, go to Visual Studio Team Services, and from your Team Project, click on the Code link at the top.  This will take you to the page that allows you to manage and create repos.  If you don’t already have an empty repo, create a new repo.  You will get instructions on how to connect to your new repo:
Copy the Clone URL.

7 – Open your command prompt and browse to the local folder where you cloned the repo from GitHub.  You can do this directly form Visual Studio by right-clicking on your new Repo and selecting Open Command Prompt.

8 – From the Command prompt, first you need to remove the connection to the GitHub repo:
git remote rm origin

9 – Now add  your VSTS repo as the new origin:
git remote add origin <your VSTS clone URL>

10 – Push your code to the new repo. You can either submit a “git push” command, or use the tools in Visual Studio to publish your code: Team Explorer –> Sync –> Push

And just like that, you will have your code in a VSTS private repo!

About esteban

Esteban is the Founder and Chief Technologist at Nebbia Technology, an ALM consulting and Azure-powered technology company. He is a software developer with a passion for ALM, TFS, Azure, and software development best practices. Esteban is a Microsoft Visual Studio ALM MVP and ALM Ranger, Pluralsight author, and the president of ONETUG (Orlando .NET User Group).

One thought on “10 Steps to move a Git repo from GitHub to Visual Studio Team Services

  1. Joe Healy

    Could mirror them in a few steps:

    Create new VSTS/VSO repo
    Get path
    git remote add seconrepository alt-machine:/path/to/repo
    Git push -f secondrepository master


Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>