Migrating from TFS to Git

TFS, Git, visualstudio 2 mins read

Today at work we discussed the idea of moving from TFS to git. Currently we have the code in the cloud on Visual Studio Team Services. Curious about how long it will take to do the move, I went ahead and allocated two hours of my time to do this. As usual I start by googling “migrate tfs to git”. The second result was a link to this article, a very well written article by Chris Kerby that has all the information you need to do the move. However, I faced some issues that I had to figure out on my own and decided to share and keep as a reference.

When you write the clone command

git-tf clone https://myaccount.visualstudio.com/DefaultCollection $/MyProject/MyBranch --deep

It is very important to keep The DefaultCollection in the account url although you wont see it in the project url when you access the account using the browser. You will see


After you enter the command you will be prompted to enter the username and password. If you have two step verification enabled the online password wont work. You need to use a personal access token from the account security section.

Generating a personal access token is easy but I included some screenshots to help.

Access Account Security Settings

Once you are in the security page in the Personal access token click Add

Access Account Security Settings

Choose your account and suitable description

Add Access Token

Make sure to copy the token generated and paste in the terminal


The cloning time will be based on how big your project and history is. For me it took around 3 hrs. After that, just follow the rest of the steps in the article mentioned above, and push to any git repo you want. You can keep the project on visual studio team services or move it to other git hosting services.