我使用BitBucket与Xcode和Git进行版本控制,最近我更改了我所有的密码(感谢Adobe!)
不出意外,我不能再把我的本地提交推到我在BitBucket上的存储库(“https://______.git”认证失败),但我忘记了如何更新iMac上缓存的密码。不知何故,我一直无法在谷歌或Stack Overflow上找到它,尽管在我看来它应该是相当直接的…
我使用BitBucket与Xcode和Git进行版本控制,最近我更改了我所有的密码(感谢Adobe!)
不出意外,我不能再把我的本地提交推到我在BitBucket上的存储库(“https://______.git”认证失败),但我忘记了如何更新iMac上缓存的密码。不知何故,我一直无法在谷歌或Stack Overflow上找到它,尽管在我看来它应该是相当直接的…
当前回答
考虑到2021年8月13日起新的令牌身份验证要求,这可能就是你想要的:
生成一个新的访问令牌
更新用于访问您的回购的令牌
git remote remove origin
git remote add origin https://[TOKEN]@github.com/[USER]/[REPO]
git push
其他回答
要在macOS上修复此问题,可以使用
git config --global credential.helper osxkeychain
您的下一个Git操作(拉、克隆、推等)将出现用户名和密码提示。
对于Windows,它是相同的命令,但参数不同:
git config --global credential.helper wincred
在Windows 10中使用Git
删除/更新存储在>>控制面板\所有控制面板项\凭证管理器中的Windows凭证中的相关凭证
或者你可以使用搜索栏搜索“CredentialManager”或“Windows Credentials”,这应该会返回一个打开控制面板窗格的条目(至少对于英语用户来说)。
运行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)
在我的Windows机器上,我尝试了@nzrytmn的解决方案,即, 控制面板>搜索凭据>选择“ManageCredentials”>在对应我的用户名的git选项类别下修改了新的凭据。 然后,
删除当前密码:
git config --global --unset user.password
新增新密码:
git config --global --add user.password "new_password"
这招对我很管用。
我遇到了同样的问题,接受的答案没有帮助我,因为密码没有存储在钥匙链中。我输入:
git pull https://myuser@bitbucket.org/mypath/myrepo.git
然后控制台要求我输入新密码。