我正在使用BitBucket、Xcode和Git进行版本控制,最近我更改了所有密码(感谢Adobe!)。
毫不意外的是,我无法将本地提交推送到BitBucket存储库(身份验证失败,'https://______.git'
),但我忘记了如何在我的iMac上更新缓存密码。虽然我认为这应该非常简单,但我在Google或Stack Overflow上找不到它...
我正在使用BitBucket、Xcode和Git进行版本控制,最近我更改了所有密码(感谢Adobe!)。
毫不意外的是,我无法将本地提交推送到BitBucket存储库(身份验证失败,'https://______.git'
),但我忘记了如何在我的iMac上更新缓存密码。虽然我认为这应该非常简单,但我在Google或Stack Overflow上找不到它...
若要在 macOS 上解决此问题,您可以使用
git config --global credential.helper osxkeychain
下一步 Git 操作(pull、clone、push 等)将出现用户名和密码提示。
对于 Windows 平台,使用同样的命令但传入不同参数:
git config --global credential.helper wincred
--global
。 - nemnesic在MacOS Sierra 10.12.4上,其他答案都对我无效。
以下是我必须执行的操作:
git config --global --unset user.password
然后运行你的 Git 命令(例如 git push
),并重新输入你的用户名和密码。
git pull
命令 - Windows弹出窗口提示输入密码。谢谢! - shemekh我修改Git密码的唯一途径是打开Windows凭据管理器(快捷键为Windows键 + 搜索“凭据”),并在Windows凭据 - 通用凭据下编辑Git条目。注意:不按字母顺序排列。
我遇到了同样的问题,而且被接受的答案没有帮助我,因为密码没有存储在钥匙串中。我键入了:
git pull https://myuser@bitbucket.org/mypath/myrepo.git
然后控制台要求我输入新密码。
针对 Mac 用户
如果你有多个远程代码库(如 Github、Bitbucket、Job 等)
1) 在项目目录下运行
git config --unset user.password
2) 运行远程 git 命令(例如 git push 或 git pull)
Git 会提示您重新输入此存储库的 user.name 和 user.password。
或者如果您只有一个远程存储库,您可以全局执行此操作。
git config --global --unset user.password
在我的MacOS Big Sur 11.3.1上,其他答案都不适用于我。
我在Github上启用了双重身份验证,这会导致即使您输入的用户名和密码正确,也会失败。
以下是我所做的:
git config --global --unset user.password
然后运行您的git命令(例如:git push)并输入您的用户名。 对于密码,您需要生成一个个人访问令牌。
进入
https://github.com/settings/profile
,选择右侧的Developer Settings
。选择Personal Access Token
,点击Generate new token
。复制生成的令牌,并将其用作终端中的密码。
如果您使用 MAC 系统,可以从 Finder 中打开 KeyChain Access 应用程序,然后查找您的帐户并单击它以更新您的密码。
现在请尝试一下,一切都会顺利进行。
运行 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)