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...
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
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.
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
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://myuser@bitbucket.org/mypath/myrepo.git
Then console asked me for my new password.
If you are MAC user then you can open KeyChain Access Application from finder and then look for your account listed there. Just click on it and update your password. Now give a try and things will fall in place.
link for reference: Updating your credentials via Keychain Access
Worked for me. :)
running git config --global --unset user.password
followed by any git command would prompt you to enter username and password.
git config --global --unset user.password
git push (will prompt you for the password)
git status (will not prompt for password again)
I was pushing into the repository for the first time. So there was no HEAD
defined.
The easiest way would be to:
git push -u origin master
It will then prompt for the password, and once you enter that it will be saved automatically, and you will be able to push.
I would try to delete my account in Keychain Access and then run git clone
again. Git will ask me for a new password.
Tried everything but nothing worked. Then the following did work.
- Before any of the above steps, lock and unlock the keychain again coz sometimes it sorta gets stuck.
- Install the GitHub Desktop — it helps.
For those who are looking for how to reset access to the repository. By the example of GitHub. You can change your GitHub profile password and revoke all "Personal access tokens" in "Settings -> Developer settings" of your profile. Also you can optionally wipe all your SSH/PGP keys and OAuth/GitHub apps to be sure that access to the repository is completely blocked. Thus, all the credential managers, on any system will fail at authorisation and prompt you to enter the new credentials.
do these steps in Terminal:
Delete current password saved in your Mac
git config --global --unset user.password
Add your new password by using this command, replace with your new password:
git config --global --add user.password <new_pass>
Following steps can resolve the issue .....
- Go to the folder ~/Library/Application Support/SourceTree
- Delete the file {Username}@STAuth-bitbucket.org
- Restart Sourcetree
- Try to fetch, password filed appear, give your new password
- Also can run "git fetch" command in terminal and need to type password
- Done
In this article, they explain it in a very easy way but basically, we just need to execute a git remote set-url origin "https://<yourUserName>@bitbucket.org/<yourRepo>"
and next time you do a git pull
or a git push
you will have to put your password.
来源:https://stackoverflow.com/questions/20195304/how-do-i-update-the-password-for-git