16

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?

Manny42
  • 588
  • 2
  • 4
  • 21

5 Answers5

31

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

סטנלי גרונן
  • 2,917
  • 23
  • 46
  • 68
user9664011
  • 319
  • 3
  • 2
  • 2
    In my case it was enough to simply delete the credential. Due to corporate policy I had to Change my AD Password. – Matthias Güntert Sep 18 '18 at 06:24
  • 1
    YES! I mistyped my creds the first time......and got "stuck" Good to know about this when my password changes! – granadaCoder Nov 19 '18 at 16:32
  • 1
    For me credential manager login window refused to appear. The only way was to add the creds manually. ```git:https://servername.domain.com``` – Chris C Feb 07 '20 at 02:54
11

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
Dan H
  • 1,828
  • 2
  • 21
  • 38
9

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

Cece Dong - MSFT
  • 29,631
  • 1
  • 24
  • 39
  • Did not work for the credential manager. But I will try to add a ssh key. – Manny42 Jan 12 '17 at 18:14
  • Is SSH key working? Please check the solution in this case to see whether it is helpful: http://stackoverflow.com/questions/41474328/using-git-with-tfs-2017-works-in-visual-studio-but-not-command-line – Cece Dong - MSFT Jan 16 '17 at 02:06
  • SSH did work. I tried the solution described in this link but it seems not to work. I'll stick to SSH it's all fine for me. – Manny42 Jan 16 '17 at 10:03
  • The Credential Manager did not work for me on Git Bash either. But it did work when using PowerShell (PS). After logging in from PS, Git Bash started to work. – Pedro Feb 05 '18 at 17:31
0

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

Bruno Ferreira
  • 466
  • 7
  • 17
-1

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.

M. hsin
  • 24
  • 5