92

After updating domain password, accessing git-repo is no longer possible. VS Code and Source Tree as well as Visual Studio are returning the following error message on pull, push, fetch etc..

fatal: Authentication failed

Normally a credentials pop-up should appear however this is not happening. Also the common recommendation is not working:

git config --global credential.helper wincred
isherwood
  • 58,414
  • 16
  • 114
  • 157
Jesper Wilfing
  • 11,157
  • 5
  • 29
  • 32

13 Answers13

207

The password is stored in windows credential manager and needs to be updated. Open command prompt and enter the following command to view the list of stored passwords:

rundll32.exe keymgr.dll,KRShowKeyMgr

Scroll down in the list until you spot the git-related entries. Click it and edit the correct password.

Voilà!

Windows 10 - Stored user names and passwords

Jesper Wilfing
  • 11,157
  • 5
  • 29
  • 32
  • 2
    unlike using Control Panel\User Accounts\Credential Manager like every other answer on the internet suggests, this worked for me – Andrey Nov 07 '18 at 21:31
  • 4
    Works for me but for some reason the password is set back to the old one after a few mintues. So I have to perform this every time I want to push. Any ideas why this is? – iko79 May 13 '19 at 18:36
  • I can't open credential manager because of a computer policy. But this command fixed my problem. Many thanks! – gkonuralp May 29 '19 at 07:55
  • 2
    helped me on Win 10, but only after deleting entirely – Vitaly Leskiv Nov 09 '20 at 16:44
  • 2
    @iko79 I found the same behaviour (set back after 1 or 2 commands run). The solution seemed to be to Remove the credential instead of Editing it. Then when I ran the git command next time I was prompted, and that one stuck without getting replaced. – Michael Lucas Mar 26 '21 at 19:39
  • For users in DevOps, there is an access token instead of a password. Just delete the credential entirely and you will be prompted to login and the new PAT will be stored with appropriate access. – Kyle Burkett Jun 17 '21 at 14:31
  • 1
    @iko79 same for me. Mitendra's answer regarding CredentialsManager https://stackoverflow.com/a/64209332/521754 is a more clean/permanent solution rather then the workaround that Michael Lucas is proposing in the comments. Chose Mitendra's answer as it was the first given on Credentials Manager. – despot Jun 30 '21 at 11:56
  • what if i have deleted record from that and it still does not prompt for the credentials? – essential Sep 24 '21 at 14:12
  • This is a bit esoteric. Is there somewhere I can open a ticket to suggest that the program just prompt you for a password when it fails the first time? I'm not really sure what part of the credential chain is broken so I don't know where I would make the suggestion. – ADJenks Oct 26 '21 at 22:14
31

I agree with Jesper, Other way to do is - On windows, if you can navigate to :

Control Panel\User Accounts\Credential Manager

Under Windows Credentials\Windows Vault page on Generic Credentials, you can update the password of existing GIT record or can also add new Generic Credentials.

Updated answer for Mac users :

In case if you're here with similar issue on Mac, you can do similar thing in keychain access - by deleting the existing GIT record, & then if you pass your credentials again in git bash or any other tool a new record gets created, things should work.

whoami - fakeFaceTrueSoul
  • 17,086
  • 6
  • 32
  • 46
  • Or if you're having issue while cloning GIT repo hosted on `Azure DevOps`, check this:: https://stackoverflow.com/questions/34837173/authentication-failed-for-azure-git/56956726#56956726 – whoami - fakeFaceTrueSoul Sep 24 '20 at 22:16
20

Try the following:

  1. Click Start
  2. Type: Credential Manager
  3. See the Windows Credential Manager shortcut and double-click it to open the application.
  4. Once the app is open, click on the "Windows Credentials" tab.
  5. Locate the credentials that you want removed, they will start with "git:" and might begin with "ada:"
  6. Click on the credential entry, it will open a detail view of the entry.
  7. Click Remove and confirm removal when prompted.
Mitendra
  • 1,426
  • 17
  • 11
20

I have experience a similar issue with Windows 10 and here's how I have solved it:

  1. From Windows Search, type Credential Manager:

enter image description here

  1. Open Credential Manager, and navigate to Windows Credential Tab: enter image description here

  2. You should see an entry for git credentials in Windows Credential Manager: enter image description here

Here is the root cause, this git credentials is locally cached/saved to your local computer, and since we have changed our Active Directory password, it is currently out of synch.

  1. Click Edit, and change this to your new/changed Active Directory password (this password has to match your new/changed Active Directory password) : enter image description here

Note: This is for using git with https only, not for SSH: https://docs.github.com/en/free-pro-team@latest/github/using-git/which-remote-url-should-i-use

  1. Save, it should work (does not require terminal or machine restart).

Lastly, if you do not have access to Credentials Manager (due to admin/security policy), you can force git to prompt for password by do a git pull from the specific repo by using username based repo url, e.g.

git pull https://{yourgitusername}@{gitrepo}.git

enter image description here

Note that, this is repo specific so you will have to do this each repo.

Good luck.

Maksood
  • 1,180
  • 14
  • 19
4

Nothing worked for me, even uninstall git and reinstall. What worked for me was to create a Personal Access Token from your github account and use that as the password. This page will detail the procedures: https://medium.com/@ginnyfahs/github-error-authentication-failed-from-command-line-3a545bfd0ca8

Tech
  • 51
  • 1
  • 3
1

I faced the same issue and none of the above mentioned solutions did work. Finally I just removed git for windows and reinstalled the same without any credential managers. This solved the authentication issue with git.

Sitesh
  • 1,816
  • 1
  • 18
  • 25
1

Using Git for Windows (2.30.0), with the cross platform credential manager, with the remote set as a https GitHub address, to a public repository, doing git push by itself wasn't sufficient.

Instead I had to explicitly do git push origin main (replace main with master, or whatever your branch is) to have Git for Windows load a GitHub authentication page where I could authorize the application.

Creating a personal access token, as noted in another answer, was not necessary. Windows credentials were not present in Windows Credential Manager, but were added as Generic Windows Credentials via this method.

James Skemp
  • 8,018
  • 9
  • 64
  • 107
  • This worked for me! After authorizing in the GitHub page, is it then possible to just use `git push`? – Breno Jul 06 '21 at 17:13
  • 1
    Glad it helped! Yes, once the longer version has been used and the authorization has been completed a normal `git push` should now work. – James Skemp Jul 07 '21 at 18:52
0

I had the same issue when Cloning the repository via Bash/VS Code with "fatal:Authentication failed". I used SSH Key authentication instead to connect my repository following the article: [https://learn.microsoft.com/en-us/azure/devops/repos/git/use-ssh-keys-to-authenticate?view=azure-devops&tabs=current-page][1] I didn't get any errors after with any bash commands!

Above solution works only if your machine can SSH.

Kiran Modini
  • 1,184
  • 8
  • 5
0

Try to manually remove setting

credential.helper=wincred from

C:\Users\<YOUR LOGIN>\.gitconfig file it it's there.

For me it helped after password change in LDAP. Command to change setting didn't helped.

Maxim Korobov
  • 2,574
  • 1
  • 26
  • 44
0

Honestly, what worked for me was installing the latest version of Git (2.36.1) to the day of this comment.

Happened the same: it stoped working after I changed the AD password. But it seems to be a bug in older releases.

This was a tip that Azure DevOps gave: enter image description here

Bazil
  • 429
  • 4
  • 6
0

I got fatal: Authentication failed for 'https://github.com/test/my_test_project.git/' error when I used git commands in Microsoft OneDrive folder. After using git commands in a folder which was not connected to OneDrive, I did not get that error.

KRM
  • 1,185
  • 2
  • 13
  • 28
-1

The only thing which worked for me was to remove the remote and add it back. I have tried deleting the credentials and even reinstalling the git the latest version. But the suggested way to access the remotes repos from Github and Microsoft DevOps is by using a shared key.

Mudasar Rauf
  • 544
  • 7
  • 18
-2

I was having the same problem and the best solution would be to insert whenever putting " git clone https://@praat.scm.azurewebsites.net:443/.git " [Insert after http:// your username and @ ] and the cloning will work.