Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why TFS with GIT is not working from command line?

I want to use the git command line tools with the Microsoft Team Foundation Server Git repositories.

But every time I want to access to remote repos the authentication fails. And of course I am using Active Directory (this is a TFS server). The git repo management works perfectly from Visual Studio. (even push, sync, clone, etc).

Cloning into 'blabla'
fatal: Authentication failed for 'http://server:8080/tfs/BlaCollection/_git/blabla/'

I have intented using this patters and always fail.

  • DOMAIN\username
  • username@domainforest

Anyone has get connected using command line tools to a TFS with git server? In my company we use tokens to log on Windows, may be the reason?

like image 708
Jairo Andres Velasco Romero Avatar asked Jun 09 '16 21:06

Jairo Andres Velasco Romero


People also ask

Can I use Git with TFS?

Git in Visual Studio, Azure DevOps Services, and TFS is standard Git. You can use Visual Studio with third-party Git services, and you can also use third-party Git clients with TFS. To learn more, see Git and Azure Repos.

What is the advantage of Git over TFS?

It keeps the history clean and avoids all those unreadable merges. Compared to our time with TFS, we have much less merge conflicts now are on Git. The main reason is that Git does a three-way merge because it knows exactly where two branches started to diverge.


3 Answers

Windows Credentials -> Generic Credentials

Then add a new item with "git:" in front of the http:// i.e.:

git:http://Example.com

add domain\user as user, and password

like image 190
Kirill Chilingarashvili Avatar answered Oct 25 '22 21:10

Kirill Chilingarashvili


I did two things to make it work. Try below.

  1. Update your git to the latest version.
  2. Open Windows Credential Manager by typing the same in Windows Search and remove the git credentials in the generic credentials as shown below enter image description here
like image 41
Karthikeyan VK Avatar answered Oct 25 '22 22:10

Karthikeyan VK


Finally a collegue hit the solution and I will post it here:

Use the command:

git config --global credential.http://[tfs_server].integrated true

Of course, replace [tfs_server] with your own TFS server host name.

When Credential Manager asks for credentials just leave blanks and press OK. (I this way authentication will be performed using Kerberos).

Check here for more information https://github.com/Microsoft/Git-Credential-Manager-for-Windows#q-i-thought-microsoft-was-maintaining-this-why-does-the-gcm-not-work-as-expected-with-tfs

like image 16
Jairo Andres Velasco Romero Avatar answered Oct 25 '22 21:10

Jairo Andres Velasco Romero