How do I update the password for Git?
Solution 1
To fix this on macOS, you can use
git config --global credential.helper osxkeychain
A username and password prompt will appear with your next Git action (pull, clone, push, etc.).
For Windows, it's the same command with a different argument:
git config --global credential.helper wincred
Solution 2
None of the other answers worked for me on MacOS Sierra 10.12.4
Here is what I had to do:
git config --global --unset user.password
Then run your git command (ex. git push
) and reenter your username and password.
Solution 3
In Windows 10 with Git
Remove/update related Credentials stored in Windows Credentials in >>Control Panel\All Control Panel Items\Credential Manager
Solution 4
The only way I could modify my git password was to go to Credential Manager in Windows (Windows Key + type 'credential') and edit the git entry under Windows Credentials 🡒 Generic Credentials. Note: Not listed alphabetically
Solution 5
I had the same problem, and the accepted answer didn't help me because the password wasn't stored in the keychain. I typed:
git pull https://[email protected]/mypath/myrepo.git
Then console asked me for my new password.
Ken M. Haggerty
I'm an intermediate programmer. I taught myself Objective-C for iOS so that I can better understand the work and frustrations that go into developing consumer software. My first iOS app is now on the Apple App Store! AppStore.com/Threeo I have previously played around with: MATLAB w/ Psychtoolbox • Python w/ PyQT • HTML / CSS / JS • Scheme w/ MIT-Church I am currently working on: • Akay, a crowdsourced data management app for iPhone and iPod touch • Updates to Threeo, including in-app purchasing and asynchronous multiplayer I know that I will never become an expert programmer but I hope to learn enough to be able to hold an intelligent conversation and work with interested programmers.
Updated on July 08, 2022Comments
-
Ken M. Haggerty almost 2 years
I'm using BitBucket with Xcode and Git for version control, and recently I changed all of my passwords (thanks Adobe!).
Unsurprisingly, I'm no longer able to push my local commits to my repository on BitBucket (
Authentication failed for 'https://______.git'
), but I'm forgetting how to update the cached password on my iMac. Somehow I've been unable to find it on Google or Stack Overflow, though it seems to me it should be rather straightforward... -
b_dubb over 7 yearsOn Mac OS 10.12.2 and when I did the above - checked and double checked that I entered it correctly - and nothing happened.
-
Anita Mehta over 7 yearsI tried like this only but still credential pop is displaying, instead of reset password
-
rkd almost 7 yearsWorked for me just now on 10.12.3 (Sierra). Had to do it twice though but that may have been a VPN/network issue
-
user2782001 almost 7 years@b_dubb It might not do anything until the next time you reach out (push, pull,fetch) then you will be prompted for credentials.
-
Fawwad almost 7 yearsif i push from local to my remote server then which password i have to use ? Is this my remote server credential password or other ?
-
Pritam Banerjee almost 7 years@Fawwad It's the password for the remote repository.
-
Fawwad almost 7 yearsMy remote server is not github.com. It is my dedicated server where i installed Git.
-
neuralmer almost 7 years@user2782001 I was using the osxkeychain helper, running the mac command did nothing. I suspect that if someone was not using the helper before, changing the configuration to use the helper, it would see that a password had not been entered for that remote, it would prompt, and everything would be fine the first time. Subsequent changes of the configuration would not prompt. The answer below worked for me.
-
disklosr over 6 yearsDoes not work on windows. Doesn't prompt for the new password
-
Coach Roebuck over 6 yearsThis is what I chose to do. I had multiple github accounts stored in the Keychain. I chose to delete them all. Successfully pushed my local branch.
-
shdobxr over 6 yearsThis was the proper method that worked for me (on mac)
-
phocks over 6 yearsWorked perfectly on Sierra. So silly that it doesn't just ask you to re-login. It just fails with a
remote: Invalid username or password.
-
Joshua Eric Turcotte over 6 yearsThis only worked for me (on sierra) up to the point where it began asking me for un/pw ... but it refuses to accept what I have demonstrated to myself over and over again to be the correct password. I do have two-factor enabled, so I have to assume it is involved, but I'm not being prompted for anything related to that.
-
fiskra over 6 yearsIt worked for me, but I had to reset captcha first. Thank you.
-
cbloss793 almost 6 yearsThis saved me! I was storing it in composer, but it was also creating an auth.json which got annoying because I always forgot to add it to the .gitignore.
-
timwaagh almost 6 yearsi understand how this would help you push the first time, but how this would help to update the saved password.
-
Saikat almost 6 yearsThe question was asked for macOS
-
Michael over 5 years@JoshuaEricTurcotte I know this is way late, but if you have two factor enabled you need to generate an API token from your account settings in GitHub and use that for your password. Instructions here: help.github.com/articles/…
-
Daniel Diehl over 5 yearsDid not work for me on macOS Sierra 10.12.6. git version 2.8.4
-
bgenchel over 5 yearsThis does not seem to do anything. OSX El Capitan. git version 2.7.4
-
Stefan Lasiewski over 5 yearsThis is what worked for me! It allows us to update the password from one repo. Some of the other suggestions on this page will effect everything that git touches.
-
Paul Taylor over 5 yearsThankyou that worked ! before then it was prompting me for password but even though I entered new password authincation still failed.
-
Paul Solt over 5 yearsThere is no visible immediate feedback, but it works on High Sierra. I had to clone a github repository before it actually asks for the password, it seems like it just sets a "dirty" flag for the next time you do a github request as @user2782001 mentioned.
-
chill appreciator over 5 yearsThis do nothing for me on Windows. After this command I've tried to push, and it was successful, so the password is still available for git
-
dexter over 5 yearsThis was indeed the way. For users that have to work with the Dutch version of the OS: credentials ---> referentiebeheer
-
iheanyi over 5 years@Saikat and yet, many of us with the same question for windows end up finding this SO question. It's almost as if the question itself while tagged macos isn't OS specific!
-
iheanyi over 5 years@Fawwad it doesn't matter what you're using. You still need to give the credentials that provide write access to the repository to which you want to write.
-
John Lin about 5 yearsWorked for me on Win 10. Password prompt popped up and didn't need to go to Control Panel
-
nzrytmn about 5 years@halxinate which operating system you use ? This is for windows 10.
-
Kellen Stuart almost 5 yearsnot a good answer. Re-cloning is way too much for this simple task
-
Kellen Stuart almost 5 yearsThis was the only answer that worked for me on Win 10
-
yuva almost 5 yearsThis was the simplest solution. All you need to do is edit. Thanks.
-
Everts almost 5 yearsBtw, the path for me was Control Panel\User Accounts\Credential Manager but best is to type Credential to jump right in.
-
Imran Javed almost 5 years@Everts what is OS of your machine?
-
codarrior almost 5 yearsFor me the symptoms were showing like
remote: repository not found
just after I changed my Github user password on MacOS Mojave, I just followed the steps outlined here help.github.com/en/articles/…. Great help. -
John Demetriou almost 5 yearsWell, calling the command git push (or pull) just gave me authentication error and access denied. Did not prompt me
-
Kevin Hooke almost 5 yearsWorks on Mojave 10.14
-
Bonifacio2 over 4 yearsThis answer doesn't cover anything that isn't covered by Derek's.
-
Lavandysh over 4 yearsThis way your password does get saved in history, and anyone who runs the history command can see it as plain text. To prevent it you can add an extra space before the command or run this command 'history -d 1234' with the right line ID afterwards
-
shemekh over 4 yearsWorked on Win10. Firstly I used command from this answer and later simply
git pull
- Windows popup appeared prompting for a password. Thanks! -
Dhaval Patel over 4 yearsThanks a lot! Save my day.
-
Sergei Emelianov over 4 yearsWoks on mac, but you have to do smt after this command, for example git pull or git fetch, so that it will prompt you to enter and save a new password.
-
vlad over 4 yearsDid not work for me. I have resolved the issue as described here: cmatskas.com/how-to-update-your-git-credentials-on-windows
-
Venkatesh Manohar over 4 yearsWorks on Mac. Thanks :)
-
pinei over 4 yearswarning: invalid credential line: ? fatal: unable to read credential from stdin
-
iphondroid about 4 yearsAfter doing this if it says incorrect password on a push request, try pulling first to get a password prompt because this command only did unset the password.
-
pvill about 4 yearsWorked for me on linux
-
Kamlesh about 4 yearsNOT WORKING DEAR, TRIED TWICE
-
nemnesic about 4 yearsJust a friendly reminder not to use
--global
if you have different accounts for different repos -
carlin.scott about 4 yearsMy preferred method for opening anything on Windows, is to tap the Windows key and type the name of the thing in, and then press enter when it pops up in the search results. It's a lot faster and easier than navigating through explorer as suggested.
-
radzimir almost 4 yearsThat worked for me under Windows 10, other methods not. This should be probably the correct answer.
-
radzimir almost 4 yearsWarning: this stores an UNENCRYPTED password in ~/.gitconfig.
-
Des Cahill almost 4 yearsLove it thanks for the help, knew there was an easier solution.
-
Denise Skidmore over 3 yearsYou can just remove rather than edit, and you'll be prompted on the next push/pull
-
Yunzhao Xing over 3 yearsThis one works for me. In Win 10, you can simply search "windows credentials" in the task bar, then edit the item you want to.
-
f1v3 over 3 yearsThanks for this! Worked perfectly on Windows 10 using mingw64.
-
ZuBsPaCe over 3 yearsThanks! I'm using git-fork and had to delete all credentials to our on-premise Azure Dev Ops server after Windows wanted me to change my domain password. Thereafter git push magically worked again without entering new credentials. Simply editing those credentials did not work.
-
Alexey Korkoza about 3 yearsAlso, this command worked on Windows 10, thank you very much.
-
Imran Javed about 3 years@ZuBsPaCe, some times you have to close related program (git, vs or etc) to get fresh data
-
Nicholas Obert about 3 yearsWorks also on linux
-
Reed about 3 yearsMy credentials disappeared from here somehow, so I ran
git fetch
in one of my repos. Windows propmpted for authentication, and then populated the credentials here as expected. -
John Fantastico about 3 years2021 and this still saved the day.
-
tok about 3 yearsThis was the only solution that worked for me on Windows 7
-
Positive Navid almost 3 yearsIt worked for windows 7 too (don't ask why our company is using ancient Windows)
-
Amal Kumar S almost 3 yearsThis worked for two-factor authentication scenario.
-
Ray Depew almost 3 yearsThis used to work, but it doesn't work anymore. @Dan Leonard's solution works well.
-
Hanane over 2 yearsThis solution worked for me, none of those above did, I want to specify that USER is not the username that u use to access to ur github account, but the user of REPO
-
Marilynn over 2 yearsThis worked fine for me, just search for CredentialManager from the windows option and change/edit the password under Windows Credentials option. Thanks.
-
Neil Fraser over 2 yearsYes. This is the only solution that worked for me. One command one should run first is:
git remote -v
so that one can see the existing [USER] and [REPO] parameters. -
yılmaz over 2 yearsI ran command for Mac on Windows machine. It did not recognize the command but a popup opened to enter password, which I was looking for.
-
Dmitry Kabanov over 2 years@PritamBanerjee, how is this related to the question of OP?
-
Pritam Banerjee over 2 years@DmitryKabanov read the whole answer on how I did reset the password
-
Herohtar over 2 yearsThis is the correct answer and works on all platforms.
-
Takatalvi over 2 yearsIf you wanna add one credential, the Internet or network address should be something like
git:https://yourrepo.address
, then your username and pass for it. -
Ousama over 2 yearsIt works perfectly
-
Cadoiz over 2 yearsCould you add the source for your quote at the end?
-
Bazer Con over 2 yearsI updated your formatting tried to add the reference to Andrew Pye, but couldn't find something. Reformatting Renhuais comment: running
git config --global --unset user.password
and thengit push origin master
will ask you for username and password. Put that into the answer too? -
Ian Warburton over 2 yearsIf the name of your personal access token is "token" and token value is "123" then [TOKEN] = token:123 . For github.com/[USER]/[REPO], copy the URL that points at your repository - everything after "https://".
-
Sam Soffes over 2 yearsExactly what I was looking for. Source for this is: docs.github.com/en/get-started/getting-started-with-git/…
-
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.
-
Gert about 2 yearsIn Visual Studio Code, the terminal command's did not do anything for me. Opening KeychainAccess (not Keychain) searching and deleting the entry fixed the problem. When using BitBucket, search for bitbucket instead of git.
-
Imran Javed about 2 years@Kamlesh, hope it is a case of credentials at repo instead of Global. If this is the case then it will ask you to reenter credentials in case of failure or you can change it through command directly. you can try >git credential reject
-
Kamlesh about 2 years@ImranJaved Thanks for your reply. You can check my issue at stackoverflow.com/questions/70913288/…
-
ThR37 about 2 yearsDoes not work for me on Linux but might work on other platforms.
-
ThR37 about 2 yearsIt worked for me! Thanks a lot!
-
Imran Javed about 2 years@Kamlesh, if you are stuck and there is no pending pull or push then I will recommend to refresh you repo clone.
-
Arash Kamangir about 2 yearsWindows solution worked for me (win10).
-
Kamlesh about 2 years@ImranJaved git pull / push / merge / commit all are working. But due to compromised my command line password, I want to change it. Not found any solution yet. Thanks a lot.
-
Eric Aig about 2 yearsThis worked for me as well
-
Alex Christodoulou about 2 yearsThis should be the right answer for mac users, this is how mac manages passwords
-
MADHAIYAN M about 2 yearsIts working in Mac too
-
Mario about 2 yearsIndeed, this is the most portable and correct of all answers and should be the main answer to this question. It also worked for me under Linux. Thanks.
-
Chiarcos about 2 years
--global
should normally not be necessary. -
Chiarcos about 2 yearsOn Ubuntu 20.04, this did not immediately work as the username is lost and not automatically requested by the next git command. However, it worked seamlessly when the next command included the user name, so, e.g.,
git pull https://[email protected]/...
. -
Plugie about 2 yearsWorks for me on windows 10
-
grefel almost 2 yearsIn German Windows the Credential Manager is called "Anmeldeinformationsverwaltung"
-
Kh.Taheri almost 2 yearsworked on M1.. thanx