'Authentication failed on tfs server

I am having a really weird issue with git bash on windows.

When I am working in Visual Studio I have no problem working with my git repo stored in a tfs server. I just branched, committed and pushed.

But when I try to do the same (fetch, pull, push...) in my git bash I get a

fatal: Authentication failed for 'https://tfs.xxxxxxxxxx.com/defaultcollection/_git/XXXXXXXXXXX/'

I tried to delete the repo and clone it from bash, but get the same error. Deleted everything related to tfs in Web/Windows Credentials (Credential Manager) did not change anything. Also tried to use git config --global --unset credential.helper. Still no result.

Has anyone got such a problem before?



Solution 1:[1]

You need to set up authentication with credential managers or SSH.

Download and run the latest Git for Windows installer, which includes the Git Credential Manager for Windows. Make sure to leave the Git Credntial Manager installation option enabled when prompted.

enter image description here

Solution 2:[2]

Go to Control Panel -> Credential Manager -> Windows Credentials (Generic Credentials).
If there is nothing that starts with git:http..., go and ADD generic credentials:

enter image description here

Solution 3:[3]

I tried the accepted answer on this thread and it didn't work for me. This command is what fixed it for me.

git config --global credential.helper wincred

Solution 4:[4]

For me the solution was go to path "C:\Users\USERNAME\AppData\Local\Atlassian\SourceTree" and removing the passwd file.

Solution 5:[5]

Could you set GIT_CURL_VERBOSE=1 as env variable to get verbose fatal message for debug. Also you can remove the proxy configuration and try again.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Cece Dong - MSFT
Solution 2 סטנלי גרונן
Solution 3 Dan H
Solution 4 Bruno Ferreira
Solution 5