Getting "fatal: Authentication failed" -error when sending git commands in Windows 10

91,135

Solution 1

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

Solution 2

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.

Solution 3

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.

Solution 4

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.

Solution 5

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

Share:
91,135
Jesper Wilfing
Author by

Jesper Wilfing

Updated on August 20, 2021

Comments

  • Jesper Wilfing
    Jesper Wilfing over 2 years

    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...

    git config --global credential.helper wincred
    

    ...is not working.

  • Andrey
    Andrey over 5 years
    unlike using Control Panel\User Accounts\Credential Manager like every other answer on the internet suggests, this worked for me
  • iko79
    iko79 almost 5 years
    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?
  • gkonuralp
    gkonuralp almost 5 years
    I can't open credential manager because of a computer policy. But this command fixed my problem. Many thanks!
  • whoami - fakeFaceTrueSoul
    whoami - fakeFaceTrueSoul over 3 years
    That's specific to GIT repos on Azure DevOps : Check this :: stackoverflow.com/questions/34837173/…
  • whoami - fakeFaceTrueSoul
    whoami - fakeFaceTrueSoul over 3 years
    Or if you're having issue while cloning GIT repo hosted on Azure DevOps, check this:: stackoverflow.com/questions/34837173/…
  • Vitaly Leskiv
    Vitaly Leskiv over 3 years
    helped me on Win 10, but only after deleting entirely
  • Michael Lucas
    Michael Lucas about 3 years
    @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.
  • oyesil
    oyesil about 3 years
    This worked for me as well. The other recommendations didn't.
  • Kyle Burkett
    Kyle Burkett almost 3 years
    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.
  • despot
    despot almost 3 years
    @iko79 same for me. Mitendra's answer regarding CredentialsManager 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.
  • Breno
    Breno almost 3 years
    This worked for me! After authorizing in the GitHub page, is it then possible to just use git push?
  • James Skemp
    James Skemp almost 3 years
    Glad it helped! Yes, once the longer version has been used and the authorization has been completed a normal git push should now work.
  • GHH
    GHH over 2 years
    Thanks. You save me a day.
  • essential
    essential over 2 years
    what if i have deleted record from that and it still does not prompt for the credentials?
  • ADJenks
    ADJenks over 2 years
    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.
  • Jeromy French
    Jeromy French over 2 years
    You just saved me a day of work.