Road to ALM

Migrate a complete Git Repository from TFS to VSTS

Published by

on

I am migrating some Git repositories from a TFS server to VSTS. Moving a Git repo including all the history is very simple fo course. Since Git is a Distributed Source Control repository. But I always forget the syntax of moving the “complete” Git repository at once. With all the branches, tags etc.

So here it is. At least for 1 reader in the future..Me..

Clone the Git repo with everything in it

git clone  [old git url] --mirror

Add the new remote

git remote add vsts [new git url] 

Push all the changes

git push vsts --mirror

That’s it !

4 responses to “Migrate a complete Git Repository from TFS to VSTS”

  1. Arjan Avatar
    Arjan

    Haha, it’s the magic mirrror switch!

    1. Rene van Osnabrugge Avatar

      Now that I have wrote it down I probably won’t ever forget it anymore 🙂

  2. Luke Avatar
    Luke

    I’m facing an issue. It shows me the below

    No refs in common and none specified; doing nothing.
    Perhaps you should specify a branch such as ‘master’.
    Everything up-to-date

    1. Rene van Osnabrugge Avatar

      Have you created a new repo ?