5

I have added Source Control (git) to my project. I have also created a project at Team Foundation Service with git. The project at Team Foundation Service is connected to my Visual Studio. I have Enabled alternate credentials. References Ref1 and Ref 2

When i run;

git remote add origin https://yourname.visualstudio.com/DefaultCollection/_git/ProjectName

Then:

git push origin master

I get this:

Username for 'https://yourname.visualstudio.com':`

After i enter username:

Password for 'https://username@hotmail.com@yourname.visualstudio.com':

After i enter password:

fatal: https://yourname.visualstudio.com/DefaultCollection/ProjectName/info/refs not found: did you run git update-server-info on the server?

I can't seem to find a solution to this, how could i make this a success?

Community
  • 1
  • 1
Komengem
  • 3,662
  • 7
  • 33
  • 57

1 Answers1

5

You could try to clone the TFS Git repo, and add your source in it, rather than trying to create the repo locally, and trying to add a remote.

The git clone would setup the (hopefully) right remote, and should let you push back whatever code you would have added and committed.


Johan Leino points out in the comments to "SourceTree + TFS Service + HTTPS: Login failed"

I set up a free TFS account to test this and can reproduce the problem.
I can also reproduce it using the standard install of Git from http://git-scm.com - it appears that out of the box, TFS won't work with standard Git.

However you can make it work by allowing 'Alternative Authentication Credentials' in TFS.

  1. Click on your username in the top-right and select 'My Profile'
  2. Select the 'Credentials' tab
  3. Click 'Enable Alternative Credentials'
  4. Click 'Set' next to the secondary user name and pick a username without an '@' character
  5. Set a password

4 and 5 seem to be optional, but I did it anyway.
Once I did this, I could clone from TFS using either my full email as a user name or the alternative user name I'd created.

It seems like the default TFS authentication is some kind of custom system that only works with the VS tools, and just enabling this alternative authentication makes it work with other systems (why isn't this the default, Microsoft?)

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • This solution is possible and i did think about it, but should be the least option, especially if you are working on `Multiple Solutions or Partitioned Solutions`. Moving source code around in a case that its being referenced or referencing another source is probably going to raise more road blocks. – Komengem Apr 26 '13 at 23:17
  • @KomengeMwandila I understand, this is more a workaround than an actual solution. – VonC Apr 26 '13 at 23:19
  • Yes, i am going to have to use it for now so i can continue with what i am trying to do. I gave you +1 but i will hold out for a few days on marking it as answer, to see if anyone can figure it out. – Komengem Apr 26 '13 at 23:24
  • see https://answers.atlassian.com/questions/173632/sourcetree-tfs-service-https-login-failed for a great explanation. – Johan Leino Sep 16 '13 at 08:44
  • 1
    @JohanLeino thank you for the link. I have included it in the answer for more visibility. – VonC Sep 16 '13 at 08:51