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).

11 thoughts 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


    1. shahab

      Looks great! is this actually a solution to mirroring of GitHub and VSTS or a new question? I just didn’t try that since I am new to git and scared of making some irreversible changes to my code. Thanks.

  2. Migrating a GitHub Repository to VSTS - Nethouse Blog

    […] VSTS has full support for Git, and pushing a Git repository to another remote is trivial. Here is a random blog post (by Esteban Garcia) about the […]

  3. Import a Git repository to VSTS | ALM Guide – Esteban GarciaALM Guide – Esteban Garcia

    […] few months ago, I blogged about moving a Git repo from GitHub to Team Services.  Since then, Microsoft has added an even easier way to import any Git repo into your VSTS […]

  4. body rafting green canyon

    We absolutely ⅼove үour blog aand find many of your
    post’s tо be exxactly what I’m looking for. Does one offer guest writers to ѡrite content to sᥙit your needs?
    I wouldn’t mind composing a pօst or elaborating on a lot of the subjects you write in relatijon to here.
    Again, awesome weblog! http://www.meera-schinzel.de/

    1. kohiubhonhu


  5. terve

    –allow-unrelated-histories saved us with fatal: refusing to merge unrelated histories

  6. apartemen collins boulevard

    Hі there! This іs myy first cоmment here so I just wanted to give a quіck shout out and say I truly enjoy readig through your articles.
    Can yߋu recоmmend any other blogs/wеbsites/forums
    that ggo oveг the same subjects? Thanks a lot! https://apartemencollinsboulevard.com/

  7. shahab

    Thank you so much.. your articles are the best in solving issues .. they’re exactly what a user looks for and cannot find in official blogs or documentation.

    BTW, is there any way to have local repo connected to both GitHub and VSTS simultaneously?

    1. esteban

      Hi Shahab,
      Yes, you can add multiple remotes: https://git-scm.com/book/en/v2/Git-Basics-Working-with-Remotes

  8. situs ceme online uang asli

    I am in fact grateful to the owner of this web page who has shared this wonderful paragraph at at this time.

Leave a Reply

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

Are you human? *