我使用BitBucket与Xcode和Git进行版本控制,最近我更改了我所有的密码(感谢Adobe!)
不出意外,我不能再把我的本地提交推到我在BitBucket上的存储库(“https://______.git”认证失败),但我忘记了如何更新iMac上缓存的密码。不知何故,我一直无法在谷歌或Stack Overflow上找到它,尽管在我看来它应该是相当直接的…
我使用BitBucket与Xcode和Git进行版本控制,最近我更改了我所有的密码(感谢Adobe!)
不出意外,我不能再把我的本地提交推到我在BitBucket上的存储库(“https://______.git”认证失败),但我忘记了如何更新iMac上缓存的密码。不知何故,我一直无法在谷歌或Stack Overflow上找到它,尽管在我看来它应该是相当直接的…
当前回答
对于MAC用户,使用git GUI(适用于Sourcetree,也可能适用于其他用户)。我想对德里克的回答补充一点意见。原建议:
$ git config --global --unset user.password
应该跟着一个推/拉/取,但它可能不会工作时,从GUI。%100的工作情况是在控制台执行第一个连续的提示触发git命令。这里有一个例子:
定位到git存储库根目录 输入$ git config——unset user.password 在终端中执行您选择的git推荐,例如:$ git push
然后它会要求您提供新密码。
其他回答
如果你是MAC用户,那么你可以从finder打开KeyChain访问应用程序,然后寻找你列出的帐户。只需点击它并更新你的密码。 现在试一试,一切都会迎刃而解。
链接参考:更新您的凭证通过钥匙链访问
对于那些正在寻找如何重置对存储库的访问的人。以GitHub为例。您可以更改您的GitHub配置文件密码,并在配置文件的“设置->开发人员设置”中撤销所有“个人访问令牌”。此外,您还可以选择擦除所有SSH/PGP密钥和OAuth/GitHub应用程序,以确保对存储库的访问完全被阻止。因此,任何系统上的所有凭据管理器在授权时都会失败,并提示您输入新的凭据。
在MacOS Sierra 10.12.4上,其他答案都不适用
以下是我必须做的:
git config --global --unset user.password
然后运行你的git命令(例如git push)并重新输入你的用户名和密码。
在我的Windows机器上,我尝试了@nzrytmn的解决方案,即, 控制面板>搜索凭据>选择“ManageCredentials”>在对应我的用户名的git选项类别下修改了新的凭据。 然后,
删除当前密码:
git config --global --unset user.password
新增新密码:
git config --global --add user.password "new_password"
这招对我很管用。
这个问题很混乱,因为这个问题太复杂了。首先是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.
`