我使用BitBucket与Xcode和Git进行版本控制,最近我更改了我所有的密码(感谢Adobe!)
不出意外,我不能再把我的本地提交推到我在BitBucket上的存储库(“https://______.git”认证失败),但我忘记了如何更新iMac上缓存的密码。不知何故,我一直无法在谷歌或Stack Overflow上找到它,尽管在我看来它应该是相当直接的…
我使用BitBucket与Xcode和Git进行版本控制,最近我更改了我所有的密码(感谢Adobe!)
不出意外,我不能再把我的本地提交推到我在BitBucket上的存储库(“https://______.git”认证失败),但我忘记了如何更新iMac上缓存的密码。不知何故,我一直无法在谷歌或Stack Overflow上找到它,尽管在我看来它应该是相当直接的…
当前回答
我遇到了同样的问题,接受的答案没有帮助我,因为密码没有存储在钥匙链中。我输入:
git pull https://myuser@bitbucket.org/mypath/myrepo.git
然后控制台要求我输入新密码。
其他回答
在这篇文章中,他们用一种非常简单的方式解释了它,但基本上,我们只需要执行一个git远程set-url origin“https://<yourUserName>@bitbucket.org/<yourRepo>”,下次你做git拉或git推时,你必须输入你的密码。
运行git config——global——unset user。Password后跟任何git命令都会提示您输入用户名和密码。
git config --global --unset user.password
git push (will prompt you for the password)
git status (will not prompt for password again)
以下步骤可以解决问题.....
进入~/Library/Application Support/SourceTree文件夹 删除文件{Username}@STAuth-bitbucket.org 重启Sourcetree 尝试获取,密码文件出现,给你的新密码 也可以在终端运行git获取命令,需要输入密码 完成
我试了所有方法,但都没用。然后下面的方法起作用了。
在进行上述任何步骤之前,再次锁定和解锁钥匙链,因为有时它会卡住。 安装GitHub桌面-它有帮助。
这个问题很混乱,因为这个问题太复杂了。首先是MacOS vs Win10。然后是不同的认证机制。
我将在这里开始一个统一的答案,可能需要一些帮助,如果我没有得到帮助,我会继续研究答案,直到它完成,但这需要时间。
Windows 10: |
|-- Run this command. You will be prompted on next push/pull to enter username and password:
| git config --global credential.helper wincred (Thanks to @Andrew Pye)
` MacOS:
|
|-- 1. Using git config to store username and password:
| git config --global --add user.password
|
|---- 1.1 first time entry
| git config --global --add user.password <new_pass>
|
|---- 1.2 password update
| git config --global --unset user.password
| git config --global --add user.password <new_pass>
|
|-- 2. Using keychain:
| git config --global credential.helper osxkeychain
|
|---- 2.1 first time entry
| Terminal will ask you for the username and password. Just enter it, it will be
| stored in keychain from then on.
|
|---- 2.2 password update
| Open keychain, delete the entry for the repository you are trying to use.
| (git remote -v will show you)
| On next use of git push or something that needs permissions, git will ask for
| the credentials, as it can not find them in the keychain anymore.
`