Git credential helper - update password

372,832

Solution 1

None of these answers ended up working for my Git credential issue. Here is what did work if anyone needs it (I'm using Git 1.9 on Windows 8.1).

To update your credentials, go to Control PanelCredential ManagerGeneric Credentials. Find the credentials related to your Git account and edit them to use the updated password.

Reference: How to update your Git credentials on Windows

Note that to use the Windows Credential Manager for Git you need to configure the credential helper like so:

git config --global credential.helper wincred

If you have multiple GitHub accounts that you use for different repositories, then you should configure credentials to use the full repository path (rather than just the domain, which is the default):

git config --global credential.useHttpPath true

Solution 2

On my first attempt to Git fetch after my password change, I was told that my username/password combination was invalid. This was correct as git-credential helper had cached my old values.

However, I attempted another git fetch after restarting my terminal/command-prompt and this time the credential helper prompted me to enter in my GitHub username and password.

I suspect the initial failed Git fetch request in combination with restarting my terminal/command-prompt resolved this for me.

I hope this answer helps anybody else in a similar position in the future!

Solution 3

If you are a Windows user, you may either remove or update your credentials in Credential Manager.

In Windows 10, go to the below path:

Control PanelAll Control Panel ItemsCredential Manager

Or search for "credential manager" in your "Search Windows" section in the Start menu.

Then from the Credential Manager, select "Windows Credentials".

Credential Manager will show many items including your outlook and GitHub repository under "Generic credentials"

You click on the drop down arrow on the right side of your Git: and it will show options to edit and remove. If you remove, the credential popup will come next time when you fetch or pull. Or you can directly edit the credentials there.

Solution 4

Solution using command line for Windows, Linux, and MacOS

If you have updated your GitHub password on the GitHub server, in the first attempt of the git fetch/pull/push command it generates the authentication failed message.

Execute the same git fetch/pull/push command a second time and it prompts for credentials (username and password). Enter the username and the new updated password of the GitHub server and login will be successful.

Even I had this problem, and I performed the above steps and done!!

Solution 5

First find the version you are using with the Git command git --version. If you have a newer version than 1.7.10, then simply use this command:

git config --global credential.helper wincred

Then do the git fetch , then it prompts for the password update.

Now, it won't prompt for the password for multiple times in Git.

Share:
372,832

Related videos on Youtube

Andrew Thomson
Author by

Andrew Thomson

Updated on May 03, 2022

Comments

  • Andrew Thomson
    Andrew Thomson almost 2 years

    I'm currently using GitHub over HTTPS and have the latest version of Git installed (1.9.0) along with the Git credential helper on Windows 7.

    On setting up my environment, I told git-credentials to permanently remember my username and password.

    I've recently updated my GitHub password via the website and I'm now no longer able to push/pull/fetch, etc.

    How I would go about updating my password on git-credentials helper on Windows 7?

    • Akshay Lokur
      Akshay Lokur about 7 years
      Simple, use "git config --global credential.helper wincred" and enter userID and password; then this will be stored for you, next time you change your password, rerun above command.
    • Ravimallya
      Ravimallya about 7 years
      @AkshayLokur this is the correct answer.
    • Paul F. Wood
      Paul F. Wood almost 7 years
      If all else fails, and you're using TortoiseGit, you might want to try an action via that. For example a pull or fetch using Tortoise will prompt for the password, which you can then update. This seems to then overwrite the Git Bash cache, and you can use bash once more.
    • FelyAnony
      FelyAnony about 3 years
      @AkshayLokur This does not work for me, I get a message: "error: cannot overwrite multiple values with a single value".
    • ijuneja
      ijuneja about 3 years
      In addition to the comment by @AkshayLokur I had to follow the top comment under this question
  • Quan
    Quan about 7 years
    Just restart Git Bash, it will prompt a dialog to enter new username / password.
  • codewario
    codewario almost 7 years
    For the record, I was able to workaround this by doing another pull/fetch without restarting my Powershell session on Windows 7. Windows prompted me for my new creds on the second attempt.
  • Farooque
    Farooque almost 7 years
    @ Vincent: what is the issue you are getting??
  • low_rents
    low_rents almost 7 years
    restarting the console/app made "wincred" work for me. ( I had to restart my console and "Atom" and everything worked fine )
  • disklosr
    disklosr over 6 years
    This doesn not answer the question
  • navigator_
    navigator_ over 6 years
    Entering any git command which requires credentials a second time seems to do this, not just git fetch, it also worked on a second git clone.
  • M. F.
    M. F. over 6 years
    This should be the accepted answer if git config --list contains credential.helper=wincred.
  • rwalter
    rwalter about 6 years
    Worked for me - thank you - and learnt about Windows credential manager too.
  • BiAiB
    BiAiB almost 6 years
    This. changing the password didn't work but I deleted the credentials and then git push asked for credentials again and it worked.
  • Thinhbk
    Thinhbk almost 6 years
    I think it works for window 8.1 and window 10 also. In my case: window 10 Pro, git 2.17
  • Thulasiram
    Thulasiram almost 6 years
    Worked for me. Thanks :)
  • Nilpo
    Nilpo over 5 years
    @disklosr Yes it does. It forces Git to prompt for the updated password the next time you perform a remote action.
  • Venkatesh Manohar
    Venkatesh Manohar over 5 years
    Worked for me. Thanks :)
  • maaz
    maaz over 5 years
    You saved my life <3
  • RichMeister
    RichMeister over 5 years
    @Nilpo What is a "remote action" then? Should not "git push origin xxx" be a remote action? It isn't doing it. instead I get remote: Invalid username or password.
  • RichMeister
    RichMeister over 5 years
    I just get repeated remote: Invalid username or password. fatal: Authentication failed for
  • Farooque
    Farooque over 5 years
    @RichMeister: From second time it will ask for username/password. Just provide your username/new_password.
  • neomib
    neomib over 5 years
    After trying other options only this one worked for me. I found info here: cmatskas.com/how-to-update-your-git-credentials-on-windows
  • Rudimentary
    Rudimentary over 5 years
    Understanding the Windows Credential Manager by using the Control Panel UI is great but gets tiresome when you have to update on all machines. This single command is great since it accomplishes the same thing (removes the existing invalid credentials) which forces git to prompt for the credentials again the next time it needs them. On Windows Server 2016, command syntax to remove credential is slightly different: cmdkey /delete:git:https://your.git.server.company.com
  • Jakob
    Jakob over 5 years
    /delete{:<TargetName>} is the official syntax, but I found that the shortcut /del <TargetName> also works, at least in Windows 10 (1803).
  • Chris Stahl
    Chris Stahl over 5 years
    Thank you! This worked for me. I used to be able to re-submit my pull, fetch, or push and I would be prompted to enter my new password. For some reason that no longer works. Thanks for teaching me about the Credential Manager!
  • Alberto Chiesa
    Alberto Chiesa over 5 years
    For anyone that (like me) removes the stored credentials hoping for another prompt, but the prompt doesn't show. From Credentials Manager, you can ADD a Generic Credential with an address of git:http://yourserver:port/. Http or Https is the same, the important bit is the git: at the start.
  • Emerson Cardoso
    Emerson Cardoso about 5 years
    For me, doing the git credential fill part as-is, it generated automatically the old wrong password; I've had to set the new one manually with this command for it to work; anyway, thanks, this answer helped me with this problem!
  • Manjeet
    Manjeet about 5 years
    It worked for me. After executing this command. Do "git fetch", you will be prompted for credentials, provide it.
  • Janis Veinbergs
    Janis Veinbergs almost 5 years
    Upvote to the top! How much wasted time reading outdated solutions. Actually Git Credential Manager is to blame here I think for having to go through pain when domain passswords are rotated.
  • Kevin Hooke
    Kevin Hooke almost 5 years
    Worked for me on MacOS with cached credentials after a password change. First time get 'Authentication Failed for ...' . Tried again and was prompted for credentials, enter userid and new password, and now working again
  • Bernardo Dal Corno
    Bernardo Dal Corno almost 5 years
    great idea for an alias! delpw = !cmdkey /delete:git:$(git remote get-url $1). Usage: git delpw origin (ps: /del didn't work here, Win 10 as well)
  • Bernardo Dal Corno
    Bernardo Dal Corno almost 5 years
    after fill, shouldn't we use approve?
  • AnrDaemon
    AnrDaemon almost 5 years
    Note: this control is NOT ACCESSIBLE THROUGH METRO UI "CONTROL PANEL"! You have to run control.exe manually to see this control.
  • Michal
    Michal almost 5 years
    Many thanks for this post. Our bitbucket is not using HTTPS or SSH. After running the second command setting useHttpPath as true it stopped messaging Authentication failed.
  • TBirkulosis
    TBirkulosis over 4 years
    THANK YOU. Updating in the Control Panel's credential manager did the trick! I put my login instead of personal access token, so needed to update.
  • Thomas Weller
    Thomas Weller over 4 years
    Why --global? Don't I risk to get re-asked for all my repositories instead of just the one affected?
  • Thomas Weller
    Thomas Weller over 4 years
    On my machine git credential reject never completes
  • Thomas Weller
    Thomas Weller over 4 years
    Why the heck isn't it the default to use the full path?
  • atavio
    atavio over 4 years
    @ThomasWeller you have to hit enter to leave an empty line there, then it completes.
  • Ryan Boken
    Ryan Boken over 4 years
    This is the best/easiest answer
  • Alexander Brattsev
    Alexander Brattsev over 4 years
    thank you very much! Every time I change my domain password, I have to remember how to update my credentials.Git fetch - It worked for me!
  • atavio
    atavio about 4 years
    You are welcome @DavidCallanan! It's funny, the answer is pretty buried under the other answers, but still helping some people.
  • jaw
    jaw almost 4 years
    This helped a lot! I didn't even know that this tools existed.
  • SoEzPz
    SoEzPz over 3 years
    Yup, this was the one.
  • Waqas Ahmed
    Waqas Ahmed over 3 years
    Worked for me :) Thank You!
  • Jorge.V
    Jorge.V over 3 years
    This will only work if you are logged as the user whose credentials you want to change; if you run git bash as admin and you are not admin, or you are changing credentials for a different user, this method won't work for obvious reasons.
  • htafoya
    htafoya over 3 years
    For Windows 10 it is named: Control Panel > User Accounts > Manage your Credentials > Windows Credentials, search for the git credentials and edit
  • Kokodoko
    Kokodoko over 3 years
    Sadly not working for me on MacOS Big Sur. Git just keeps using the old name/password credentials.
  • Hugo P
    Hugo P about 3 years
    You saved my life, bro
  • Patrick vD
    Patrick vD about 3 years
    +1 for giving a git-based solution instead of a windows based one. I'm running linux and needed to switch from a password to a PAT and this was the only answer that worked.
  • Arsman Ahmad
    Arsman Ahmad almost 3 years
    This helped a lot.
  • AlbertM
    AlbertM almost 3 years
    This doesn't only work with wincred but also with the credential manager core that comes with recent git version. Therefore you can use git config --global credential.helper manager-core which also stores the credential in the above mentioned Windows Credential Manager (German: Anmeldeinformationsverwaltung). Tested with git 2.31.1.
  • user697473
    user697473 over 2 years
    "To update your credentials, go to Control Panel → Credential Manager → Generic Credentials." In Windows 10, there is an extra step: : Control Panel → Credential Manager → Windows Credentials → Generic Credentials.
  • Mew
    Mew over 2 years
    For non-English Windows systems, you might look for something akin to "references" instead of "credentials". Worked on Windows 7. (Translated: Configuration screen > User accounts and parental control > Reference management.)
  • David Burson
    David Burson over 2 years
    to clarify in case others are as ignorant as me: after verifying that the new credentials work, when you enter git credential approve, enter the same 2 lines again as the other calls to git credential: protocol=https followed by host=github.com.
  • Johnny Oshika
    Johnny Oshika over 2 years
    Worked on Windows. I was already logged in to github so I didn't even have to enter my username/password when the browser popped up.
  • strix25
    strix25 over 2 years
    does not work on Ubuntu
  • Kamlesh
    Kamlesh about 2 years
    There is no git related generic credentials on my computer while I use git commit, push, pull everyday. Then how can we update the password? Please suggest. Thanks.
  • Kamlesh
    Kamlesh about 2 years
    There is no git related generic credentials on my computer while I use git commit, push, pull everyday. Then how can we update the password? Please suggest. Thanks.
  • Kamlesh
    Kamlesh about 2 years
    There is no git related generic credentials on my computer while I use git commit, push, pull everyday. Then how can we update the password? Please suggest. Thanks.
  • Niko
    Niko about 2 years
    Accessing Credential Manager support.microsoft.com/en-us/windows/…
  • Tyler V.
    Tyler V. almost 2 years
    This answer is a bit unclear. It looks like one is editing a text file or something here. Just a heads up for everyone else: This is just multi-line CLI input.