Git credential helper - update password
Asked Answered
I

13

269

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?

Isis answered 15/9, 2014 at 10:29 Comment(5)
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.Spaceband
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.Danialah
@AkshayLokur This does not work for me, I get a message: "error: cannot overwrite multiple values with a single value".Cryptanalysis
In addition to the comment by @AkshayLokur I had to follow the top comment under this questionMetalinguistics
Does this answer your question? How do I update the password for Git?Sparker
S
387

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
Salsify answered 2/10, 2017 at 18:41 Comment(12)
This should be the accepted answer if git config --list contains credential.helper=wincred.Halstead
Worked for me - thank you - and learnt about Windows credential manager too.Mohenjodaro
This. changing the password didn't work but I deleted the credentials and then git push asked for credentials again and it worked.Laodicea
I think it works for window 8.1 and window 10 also. In my case: window 10 Pro, git 2.17Numbersnumbfish
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!Camus
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.Varicose
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.Superficial
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.Olds
Why the heck isn't it the default to use the full path?Protanopia
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.Fortissimo
"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.Strand
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.)Coachwhip
I
130

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!

Isis answered 15/9, 2014 at 11:16 Comment(6)
Just restart Git Bash, it will prompt a dialog to enter new username / password.Waistband
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.Omaromara
restarting the console/app made "wincred" work for me. ( I had to restart my console and "Atom" and everything worked fine )Pallor
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.Burgeon
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!Tourer
Yup, this was the one.Sprinkle
C
102

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

Complicity answered 13/10, 2016 at 5:18 Comment(10)
@ Vincent: what is the issue you are getting??Complicity
I just get repeated remote: Invalid username or password. fatal: Authentication failed forBacciferous
@RichMeister: From second time it will ask for username/password. Just provide your username/new_password.Complicity
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 againAlard
This is the best/easiest answerPitchy
Sadly not working for me on MacOS Big Sur. Git just keeps using the old name/password credentials.Izettaizhevsk
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.Programme
does not work on UbuntuThereabouts
Works like a charm for me, by far the best answer. (Windows 10)Quixotic
Worked for me on Windows 10 & VSCode with WSL.Method
U
102

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.

Unanimous answered 23/10, 2018 at 19:27 Comment(5)
After trying other options only this one worked for me. I found info here: cmatskas.com/how-to-update-your-git-credentials-on-windowsBerm
Note: this control is NOT ACCESSIBLE THROUGH METRO UI "CONTROL PANEL"! You have to run control.exe manually to see this control.Heroworship
This helped a lot! I didn't even know that this tools existed.Fusible
This helped a lot.Farcical
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.Upi
S
46

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.

Sidesaddle answered 17/11, 2015 at 20:48 Comment(5)
This doesn not answer the questionCalli
@Calli Yes it does. It forces Git to prompt for the updated password the next time you perform a remote action.Chitter
@Chitter 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.Bacciferous
It worked for me. After executing this command. Do "git fetch", you will be prompted for credentials, provide it.Osswald
Why --global? Don't I risk to get re-asked for all my repositories instead of just the one affected?Protanopia
A
46

It seems to me that the answers here are outdated. For me using Git v2.15.0 issuing git credential reject like this did the job:

$ git credential reject
protocol=https
host=github.com
<Empty line here>

And then to set the new username & password:

$ git credential fill
protocol=https
host=github.com
<empty line here>

After this, if the credentials now work on the desired target host, we should use git credential approve -as mentioned in typical use of Git credentials (step 4)- to tell the credential helpers to mark the credentials as approved and reuse them in future connections.

And answered 21/11, 2017 at 13:10 Comment(10)
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!Cimah
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.Cookson
after fill, shouldn't we use approve?Lassalle
On my machine git credential reject never completesProtanopia
@ThomasWeller you have to hit enter to leave an empty line there, then it completes.And
You are welcome @DavidCallanan! It's funny, the answer is pretty buried under the other answers, but still helping some people.And
You saved my life, broWarrior
+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.Enosis
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.Premarital
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.Terina
H
27

FWIW, I stumbled over this very same problem (and my boss too, so it got more intense).

The instant solution is to delete or fix your Git entries in the Windows Credential Manager. You may have a hard time finding it in your localized Windows version, but luckily you can start it from the good old Windows + R run dialog with control keymgr.dll or control /name Microsoft.CredentialManager (or rundll32.exe keymgr.dll, KRShowKeyMgr if you prefer the classic look). Or put this in a batch file for your colleagues: cmdkey /delete:git:http://your.git.server.company.com.

In Microsoft's Git Credential Manager this is a known issue that may be fixed as soon as early 2019 (so don't hold your breath).

Update (2020-09-30): GCM4W seems to be more or less abandoned (last release more than a year ago, only one commit to master since then named, I kid you not, "Recreate the scalable version of the GCM Logo"). But don't despair, with Microsoft now going Core, there is a shiny new project called GCM Core, which seems to handle password changes correctly. It can be installed standalone (should be activated automatically, otherwise activate e.g. with git config --system credential.helper manager-core) but is also included in the current Git for Windows 2.28.0. For more information about it, see this blog post.

Hip answered 29/11, 2018 at 14:56 Comment(3)
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.comGavelkind
/delete{:<TargetName>} is the official syntax, but I found that the shortcut /del <TargetName> also works, at least in Windows 10 (1803).Hip
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)Lassalle
S
22

Working solution for Windows:

Control Panel > User Accounts > Credential Manager > Generic Credentials

enter image description here

Sitnik answered 14/9, 2020 at 3:18 Comment(3)
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.Ascidium
For Windows 10 it is named: Control Panel > User Accounts > Manage your Credentials > Windows Credentials, search for the git credentials and editAdenaadenauer
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.Upi
C
7

Just cd in the directory where you have installed git-credential-winstore. If you don't know where, just run this in Git Bash:

cat ~/.gitconfig

It should print something looking like:

[credential]
    helper = !'C:\\ProgramFile\\GitCredStore\\git-credential-winstore.exe'

In this case, you repository is C:\ProgramFile\GitCredStore. Once you are inside this folder using Git Bash or the Windows command, just type:

git-credential-winstore.exe erase
host=github.com
protocol=https

Don't forget to press Enter twice after protocol=https.

Cockaigne answered 2/6, 2015 at 9:52 Comment(0)
A
7

None of the current solutions worked for me with git bash 2.26.2. This should work in any case if you are using the windows credential manager.

One issue is the windows credential manager runs for the logged user. In my case for example, I run git bash with right click, run as admin. Therefore, my stored credentials are in a credentials manager which I can't access with the windows GUI if I don't login to windows as admin.

To fix this:

  • Open a cmd as admin (or whatever user you run git bash with)
  • Go to windows/system32
  • Type cmdkey /list. Your old credentials should appear here, with a part that reads ...target:xxx...
  • Type cmdkey /delete:xxx, where xxx is the target from the previous line

It should confirm you that your credentials have been removed. Next time you do any operation in git bash that requires authentication, a popup will ask for your credentials.

Ascidium answered 22/5, 2020 at 9:48 Comment(1)
Accessing Credential Manager support.microsoft.com/en-us/windows/…Emulous
A
6

For Windows 10 it is:

Control Panel > User Accounts > Manage your Credentials > Windows Credentials, search for the git credentials and edit

Adenaadenauer answered 17/12, 2020 at 21:56 Comment(1)
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.Upi
T
2

If you have reset your password, hence you are getting Auth failure error in the git bash command window. (it does not show popup where you could enter new password).

In the git bash cmd window enter following command:

$ git config --global credential.helper wincred

Some times it will show popup to enter the new password or Sometimes popup will be displayed when you are trying to do $git clone ..command

Teodora answered 14/9, 2021 at 16:28 Comment(0)
T
1

If you keep getting "fatal: Authentication failed for "https://......git" and you are unable to update the password.

  1. $ git config --global credential.helper wincred
  2. git clone -b ..git
  3. Popup will be displayed for username password
  4. enter the new password
Teodora answered 5/12, 2022 at 16:23 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.