我使用BitBucket与Xcode和Git进行版本控制,最近我更改了我所有的密码(感谢Adobe!)
不出意外,我不能再把我的本地提交推到我在BitBucket上的存储库(“https://______.git”认证失败),但我忘记了如何更新iMac上缓存的密码。不知何故,我一直无法在谷歌或Stack Overflow上找到它,尽管在我看来它应该是相当直接的…
我使用BitBucket与Xcode和Git进行版本控制,最近我更改了我所有的密码(感谢Adobe!)
不出意外,我不能再把我的本地提交推到我在BitBucket上的存储库(“https://______.git”认证失败),但我忘记了如何更新iMac上缓存的密码。不知何故,我一直无法在谷歌或Stack Overflow上找到它,尽管在我看来它应该是相当直接的…
当前回答
我也遇到了同样的问题(在Windows 10上,Git版本2.34.1.windows。1,使用个人访问令牌与SAML单点登录启用我的组织): 当我发布 git拉 在我的回购,我收到了错误信息
错误:xxx组织已经启用或强制SAML单点登录。访问 此存储库,您必须使用带有个人访问令牌的HTTPS远程 或SSH,使用SSH密钥和密码 这是本组织授权的。访问 https://docs.github.com/articles/authenticating-to-a-github-organization-with-saml-single-sign-on/获取更多信息。 无法从远程存储库读取。
我发现在我的.git/config文件中我有这样的: Url = git@github.com:myorg/myrepo.git
上面错误消息中的链接统计使用SAML SSO(个人访问令牌,PAT),所以我将其更改为 Url = https://www.github.com/myorg/myrepo.git
这一次在发出git命令时 git拉 我看到了一个登录对话框,我可以在其中提供我的PAT令牌,它开始工作。
其他回答
运行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)
您可以在2个地方通过命令行更改密码,下面将编辑凭证以连接repo
git config --edit
凭据也可以在全局中使用如下所示的全局参数进行更改
git config --global --add user.password "XXXX"
或将凭据助手设置为
git config --global credential.helper wincred
但如果你有回购级别的凭据设置使用第一个命令
git config --edit
以下步骤可以解决问题.....
进入~/Library/Application Support/SourceTree文件夹 删除文件{Username}@STAuth-bitbucket.org 重启Sourcetree 尝试获取,密码文件出现,给你的新密码 也可以在终端运行git获取命令,需要输入密码 完成
在Windows 10中使用Git
删除/更新存储在>>控制面板\所有控制面板项\凭证管理器中的Windows凭证中的相关凭证
或者你可以使用搜索栏搜索“CredentialManager”或“Windows Credentials”,这应该会返回一个打开控制面板窗格的条目(至少对于英语用户来说)。
这个问题很混乱,因为这个问题太复杂了。首先是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.
`