JairoV
JairoV

Reputation: 2104

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.

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?

Upvotes: 34

Views: 28286

Answers (12)

MohamedHarmoush
MohamedHarmoush

Reputation: 1352

I've faced this issue before in SourceTree and solved using using the below solution

In Windows

  • Open Control Panel > Credential Manager > Windows Credentials.

or just search Windows Credentials in windows search.

Under Generic Credentials -> Add a generic credential

And fill these data

Replace test with the domain of your company. Put your EID or credentials to log into TFS.

And in SourceTree

  • From Tools> Options> Git> Disable SSL certificate validation

Upvotes: 1

junnyea
junnyea

Reputation: 640

  1. Remove your git credentials from Windows Control Panel (as what everyone is suggesting)

  2. If cmd still not prompting you for reentering of git credentials. e.g

fatal: Authentication failed for ....

You may try to uninstall your git-windows and choose the 'None' option. To avoid using a credentials helper.

Screenshot page for None Option

Upvotes: 0

Victor Cañas
Victor Cañas

Reputation: 25

My solution

Open Control Panel > Credential Manager > Windows Credentials.

Under Generic Credentials -> Add a generic credential

Inter network address: git:https://tfs.[google].com

admin:

password:

Replace google with the domain of your company. Put your EID or credentials to log into TFS.

Upvotes: 2

Karthikeyan VK
Karthikeyan VK

Reputation: 6006

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

Upvotes: 22

Patrice Calvé
Patrice Calvé

Reputation: 694

Did you change your AD password recently ?

  • If so, (or not lol), Go to Control Panel > User Accounts > Credential Manager > Windows Credentials.
  • Locate entries starting with git:http...
  • Either Remove that/those entry, or edit the password to the new one. Click on the Down Arrow and you see info about that entry, including the Remove/Edit links

Upvotes: 1

joacar
joacar

Reputation: 961

For me it was that a proxy had been set in config. >git config --global --unset http.proxy made it work. Running a VM Windows Server 20196 and TFS2015 usind Kerberos (Windows Authentication).

Upvotes: 0

Hem
Hem

Reputation: 11

If you face this error after changing password for TFS,

Go to Control Panel\User Accounts\Credential Manager

Under the Windows Credentials, Modify the password for the specific Internet or network address.

Upvotes: 1

jausel
jausel

Reputation: 615

For myself, I went to Control Panel > Credential Manager > Windows Credentials.

I tried to delete only the Generic Credentials with git: in front of them, but the git commands still didn't work.

After I deleted the Windows Credentials for the TFS server, then the git commands started to work.

Upvotes: 3

Sephiroth Bloodsteel
Sephiroth Bloodsteel

Reputation: 56

No matter, how your company use to log on windows, you just need the account which login in the TFS. You can find the account info in Windows-Control Panel- Credential Manager

by PatrickLu-MSFT

This is what did it for me. I just opened the Windows Credential Manager as stated above and edited the credentials because some how it was stuck to my previous password.

Upvotes: 2

Kirill Chilingarashvili
Kirill Chilingarashvili

Reputation: 1089

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

Upvotes: 43

JairoV
JairoV

Reputation: 2104

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

Upvotes: 17

PatrickLu-MSFT
PatrickLu-MSFT

Reputation: 51103

Try to use the Authentication --username and --password parameters with the command directly such as:

git tfs clone http://tfs:8080/tfs/DefaultCollection $/Project1 -u=Domain\username -p=xxx

-u, --username=VALUE stands for TFS username
-p, --password=VALUE stands for TFS password

No matter, how your company use to log on windows, you just need the account which login in the TFS. You can find the account info in Windows-Control Panel- Credential Manager


Visual Studio store credentials in the Windows Credential Manager, which is compatible with the Git Credential Winstore. If you install Git Credential Winstore, it should permanently authenticating with Git repositories, you can also give this tool a try.

Upvotes: -1

Related Questions