Git credential helper - update password
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 Panel → Credential Manager → Generic 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 Panel → All Control Panel Items → Credential 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.
Related videos on Youtube
Andrew Thomson
Updated on May 03, 2022Comments
-
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 about 7 yearsSimple, 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 about 7 years@AkshayLokur this is the correct answer.
-
Paul F. Wood almost 7 yearsIf 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 about 3 years@AkshayLokur This does not work for me, I get a message: "error: cannot overwrite multiple values with a single value".
-
ijuneja about 3 yearsIn addition to the comment by @AkshayLokur I had to follow the top comment under this question
-
-
Quan about 7 yearsJust restart Git Bash, it will prompt a dialog to enter new username / password.
-
codewario almost 7 yearsFor 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 almost 7 years@ Vincent: what is the issue you are getting??
-
low_rents almost 7 yearsrestarting the console/app made "wincred" work for me. ( I had to restart my console and "Atom" and everything worked fine )
-
disklosr over 6 yearsThis doesn not answer the question
-
navigator_ over 6 yearsEntering any git command which requires credentials a second time seems to do this, not just
git fetch
, it also worked on a secondgit clone
. -
M. F. over 6 yearsThis should be the accepted answer if
git config --list
containscredential.helper=wincred
. -
rwalter about 6 yearsWorked for me - thank you - and learnt about Windows credential manager too.
-
BiAiB almost 6 yearsThis. changing the password didn't work but I deleted the credentials and then git push asked for credentials again and it worked.
-
Thinhbk almost 6 yearsI think it works for window 8.1 and window 10 also. In my case: window 10 Pro, git 2.17
-
Thulasiram almost 6 yearsWorked for me. Thanks :)
-
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 over 5 yearsWorked for me. Thanks :)
-
maaz over 5 yearsYou saved my life <3
-
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 over 5 yearsI just get repeated remote: Invalid username or password. fatal: Authentication failed for
-
Farooque over 5 years@RichMeister: From second time it will ask for username/password. Just provide your username/new_password.
-
neomib over 5 yearsAfter trying other options only this one worked for me. I found info here: cmatskas.com/how-to-update-your-git-credentials-on-windows
-
Rudimentary over 5 yearsUnderstanding 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 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 over 5 yearsThank 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 over 5 yearsFor anyone that (like me) removes the stored credentials hoping for another prompt, but the prompt doesn't show. From Credentials Manager, you can
ADD
aGeneric Credential
with an address ofgit:http://yourserver:port/
. Http or Https is the same, the important bit is thegit:
at the start. -
Emerson Cardoso about 5 yearsFor 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 about 5 yearsIt worked for me. After executing this command. Do "git fetch", you will be prompted for credentials, provide it.
-
Janis Veinbergs almost 5 yearsUpvote 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 almost 5 yearsWorked 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 almost 5 yearsgreat 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 almost 5 yearsafter
fill
, shouldn't we useapprove
? -
AnrDaemon almost 5 yearsNote: this control is NOT ACCESSIBLE THROUGH METRO UI "CONTROL PANEL"! You have to run
control.exe
manually to see this control. -
Michal almost 5 yearsMany 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 over 4 yearsTHANK 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 over 4 yearsWhy
--global
? Don't I risk to get re-asked for all my repositories instead of just the one affected? -
Thomas Weller over 4 yearsOn my machine
git credential reject
never completes -
Thomas Weller over 4 yearsWhy the heck isn't it the default to use the full path?
-
atavio over 4 years@ThomasWeller you have to hit enter to leave an empty line there, then it completes.
-
Ryan Boken over 4 yearsThis is the best/easiest answer
-
Alexander Brattsev over 4 yearsthank 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 about 4 yearsYou are welcome @DavidCallanan! It's funny, the answer is pretty buried under the other answers, but still helping some people.
-
jaw almost 4 yearsThis helped a lot! I didn't even know that this tools existed.
-
SoEzPz over 3 yearsYup, this was the one.
-
Waqas Ahmed over 3 yearsWorked for me :) Thank You!
-
Jorge.V over 3 yearsThis 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 over 3 yearsFor Windows 10 it is named: Control Panel > User Accounts > Manage your Credentials > Windows Credentials, search for the git credentials and edit
-
Kokodoko over 3 yearsSadly not working for me on MacOS Big Sur. Git just keeps using the old name/password credentials.
-
Hugo P about 3 yearsYou saved my life, bro
-
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 almost 3 yearsThis helped a lot.
-
AlbertM almost 3 yearsThis doesn't only work with
wincred
but also with the credential manager core that comes with recent git version. Therefore you can usegit 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 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 over 2 yearsFor 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 over 2 yearsto 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 togit credential
:protocol=https
followed byhost=github.com
. -
Johnny Oshika over 2 yearsWorked 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 over 2 yearsdoes not work on Ubuntu
-
Kamlesh about 2 yearsThere 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 about 2 yearsThere 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 about 2 yearsThere 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 about 2 yearsAccessing Credential Manager support.microsoft.com/en-us/windows/…
-
Tyler V. almost 2 yearsThis 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.