10

I visited our Team Foundation Service page and found a great new feature:

New Team Project + Git

This is great news. We have Projects in Team Foundation Service AND Git. Not as much because I love Git. I was very impressed with it's functionality, but never comfortable with its interface. That said, Git is an accepted standard for Open Source and I love the idea of being able to admin my Git Repos through TFS. Getting the best of both worlds (I hope).

I was able to create a Test Project in Git and am excited.

Problem: for all the site searching, googling, poking, prodding, I can't figure out how to import an existing Git Project into TFS.

Edward Thomson
  • 74,857
  • 14
  • 158
  • 187
Dave Alperovich
  • 32,320
  • 8
  • 79
  • 101
  • 1
    Possible duplicate of [How can I push my existing Git repository to Team Foundation Service](http://stackoverflow.com/questions/15128541/how-can-i-push-my-existing-git-repository-to-team-foundation-service) – Andrew Savinykh Apr 27 '16 at 07:50
  • @AndrewSavinykh, how would this question be a duplicate of a question that was asked a month later? In fact, you should check the comment at top which marks the other question as a dupe of this one. – Dave Alperovich Apr 27 '16 at 11:22
  • That's more or less standard practice. Timing does not matter. That other question asks the same thing and has a (subjectively) better answer. In my opinion it's this question that is better be closed as a duplicate of the other newer one. – Andrew Savinykh Apr 27 '16 at 19:27
  • For example see [here](http://meta.stackexchange.com/questions/147643/should-i-vote-to-close-a-duplicate-question-even-though-its-much-newer-and-ha/147651#147651) – Andrew Savinykh Apr 27 '16 at 19:41

1 Answers1

11

tl;dr: Set your remote and push.

  1. Make sure you enable alternate credentials in Team Foundation Service.

  2. Set your remote: git remote add <name> <url>,
    e.g. git remote add origin https://yourname.visualstudio.com/DefaultCollection/_git/ProjectName

  3. Push it: git push <remote name> <name of branch>,
    e.g. git push origin branchname

SteveC
  • 15,808
  • 23
  • 102
  • 173
Edward Thomson
  • 74,857
  • 14
  • 158
  • 187
  • 1
    Any idea why after following yoru answer i would run into: `fatal: https://yourname.visualstudio.com/DefaultCollection/ProjectName/info/refs not found: did you run git update-server-info on the server?` – Komengem Apr 26 '13 at 19:31
  • That error message means your URL is wrong - double check it against the instructions on the service! – Edward Thomson Apr 27 '13 at 00:21
  • 2
    It's also worth noticing the warning in TFS: "To clone and use this repository from Git tools outside Visual Studio, you need to ensure alternate credentials are enabled in the Profile dialog." – Fernando Correia Jun 05 '13 at 17:34
  • You may get in trouble with large repos (> 5 GB). I our case we had to push to a private gitlab repo, then import via Azure web import form pointing to the new gitlab repo. – Lars Pellarin Oct 10 '18 at 13:35
  • 1
    @EdwardThomson i'm getting error of "The requested URL returned error: 500" with this format "http://tfs_server_name:8080/tfs/CollectionName/_git/ProjectName/". Is there any other specific format which should provided? – Sweta Vani Sep 04 '20 at 12:48