我使用BitBucket与Xcode和Git进行版本控制,最近我更改了我所有的密码(感谢Adobe!)

不出意外,我不能再把我的本地提交推到我在BitBucket上的存储库(“https://______.git”认证失败),但我忘记了如何更新iMac上缓存的密码。不知何故,我一直无法在谷歌或Stack Overflow上找到它,尽管在我看来它应该是相当直接的…


当前回答

在MacOS Big Sur 11.3.1上,其他答案都不适合我

我在Github上启用了双因素身份验证,这使得你在输入用户名和密码时即使他们是正确的也会失败。

以下是我必须做的:

Git配置——global——取消设置user.password

然后运行你的git命令(例如git push)并输入你的用户名。 对于密码,您需要生成一个个人访问令牌。

访问https://github.com/settings/profile,选择右边的开发者设置。Select Personal Access Token生成新的Token。复制生成的令牌,并将其作为终端的密码。

其他回答

在我的Windows机器上,我尝试了@nzrytmn的解决方案,即, 控制面板>搜索凭据>选择“ManageCredentials”>在对应我的用户名的git选项类别下修改了新的凭据。 然后,

删除当前密码:

git config --global --unset user.password

新增新密码:

git config --global --add user.password "new_password"

这招对我很管用。

我试了所有方法,但都没用。然后下面的方法起作用了。

在进行上述任何步骤之前,再次锁定和解锁钥匙链,因为有时它会卡住。 安装GitHub桌面-它有帮助。

如果你的凭据存储在凭据助手中,移除特定主机的密码持久化的可移植方法是调用git credential reject:

$ git credential reject
protocol=https
host=bitbucket.org
⏎

or

$ git credential reject
url=https://bitbucket.org
⏎

然后,输入git fetch来输入新密码。

在Terminal执行以下步骤:

删除保存在Mac中的当前密码 Git配置——global——取消设置user.password 使用此命令添加您的新密码,替换为您的新密码: Git配置——global——添加用户。密码< new_pass >

运行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)