Derik Whittaker



Moving a TFS Git Repository to Github

We gave using the git support in TFS the old college try but the friction and issues were just too much so we decided to move our repository over to github.  I am not going to go over our issues w/ TFS git here, but I am thinking of creating a separate post for it.

Because we already had our repository w/ change history setup all we really wanted to do was ‘change remote origin’ for our repository and here are the steps WE took to accomplish this.

Our Steps (it is assume you already have a github account setup)

  1. Go to and create your repository.
  2. Create a copy of your existing tfs/git source and move it to a new directly.  I do this simply to ensure I don’t screw anything up and have to do a new pull (i am lazy and xcopy is faster). 
    1. from c:\TFSRepo –> c:\GithubRepo
  3. Open a git command prompt and CD into the destination directory from step 1
  4. From the command prompt run ‘git remote –v’  this command is a sanity check to double check the current origin of your repository
  5. From the command prompt run ‘git remote rm origin’ this command will remove/clear the origin settings for your reporsitory
  6. From the command prompt run ‘git remote add origin[AccountUserNameHere]/[RepoNameHere].git’ this command will set the origin information to your new repository path in github.  Pay attention to the url’s casing as github is case sensitive and you may experience issues if the casing is off. 
    1. PS. You can get the url above from the github repository page
  7. From the command prompt run ‘git push origin master’ this command will push your current files up to github and publish them.  Please note that this will ONLY push the master branch.  If you want to push other branches you will need to do a ‘git push origin [branchnamehere]’ for each branch.
  8. Refresh the project page and rejoice in the fact that you are out of TFS and your pain should be greatly reduced :)

These are the steps that worked for us, of course they may be different or better ways, but again these worked for us.

Till next time,

Posted 04-09-2013 6:16 AM by Derik Whittaker
Filed under: ,



zihotki wrote re: Moving a TFS Git Repository to Github
on 04-09-2013 7:50 AM

Looking forward for the post about the issues you had, I hope you won't forget to write it. And very big thanks in advance :)

Jonathan wrote re: Moving a TFS Git Repository to Github
on 04-09-2013 9:14 AM

I agree with zihotki. The issues you had would be more valuable. I use the online TFS for TFS with no problem but if I want to know if i should not recomend using GIT with TFS online.

MBR wrote re: Moving a TFS Git Repository to Github
on 04-09-2013 3:47 PM

How does one carry over the version/diff history of all the files?  W/o being able to do this, probably a non-starter for many projects.

Derik Whittaker wrote re: Moving a TFS Git Repository to Github
on 04-09-2013 3:56 PM


This process will copy/move over every commit and its history.  It will be as if your code has always been in github.


MBR wrote re: Moving a TFS Git Repository to Github
on 04-09-2013 4:05 PM

Thanks - I guess I was reading this too literally:

 "this command will push your *current files* up to github and publish them"

social bookmarking service wrote re: Moving a TFS Git Repository to Github
on 04-12-2013 1:39 PM

qxmxFZ Muchos Gracias for your post.

About The CodeBetter.Com Blog Network
CodeBetter.Com FAQ

Our Mission

Advertisers should contact Brendan

Google Reader or Homepage Latest Items
Add to My Yahoo!
Subscribe with Bloglines
Subscribe in NewsGator Online
Subscribe with myFeedster
Add to My AOL
Furl Latest Items
Subscribe in Rojo

Member Projects
DimeCasts.Net - Derik Whittaker

Friends of
Red-Gate Tools For SQL and .NET


SmartInspect .NET Logging
NGEDIT: ViEmu and Codekana
NHibernate Profiler
Balsamiq Mockups
JetBrains - ReSharper
Web Sequence Diagrams
Ducksboard<-- NEW Friend!


Site Copyright © 2007 CodeBetter.Com
Content Copyright Individual Bloggers


Community Server (Commercial Edition)