小智 143
我遇到了同样的问题,上面的答案对我不起作用,因为github通过Windows凭证管理器而不是git bash提供我的凭据.
您可能必须检查Windows凭据管理器并删除下面的github条目 control panel > user accounts > credential manager > Windows credentials > Generic credentials
Ale*_*olo 65
从~/.ssh
(或存储它们的位置)删除SSH密钥.
删除您的用户设置:
git config --global --unset user.name
git config --global --unset user.email
git config --global --unset credential.helper
Run Code Online (Sandbox Code Playgroud)
或者您的全局设置:
git config --global --unset-all
Run Code Online (Sandbox Code Playgroud)
也许还有其他与凭证存储相关的东西,但我总是使用git而不是SSH.
小智 16
在Mac上,凭据存储在Keychain Access中.寻找Github并删除该凭证.更多信息:https://help.github.com/articles/updating-credentials-from-the-osx-keychain/
use*_*738 13
在 Windows 上试试这个:
cmdkey /delete:LegacyGeneric:target=git:https://github.com
Run Code Online (Sandbox Code Playgroud)
Rao*_*ngi 11
我在公司环境中,并git pull
在最近更改密码后尝试了一个简单的方法.
我有: remote: Invalid username or password.
有趣的是,以下不起作用: git config --global --unset credential.helper
我使用Windows-7,所以,我去了控制面板 - > Credential Manager - > Generic Credentials.
从凭证管理器列表中,删除与git对应的行项目.
删除后,回到gitbash和git pull应该提示您输入凭据的对话框.
由于使用其他凭据登录,我无法克隆存储库。
要切换到另一个用户,我做了:
git config --global --unset user.name
git config --global --unset user.email
git config --global --unset credential.helper
Run Code Online (Sandbox Code Playgroud)
然后我不是使用 ssh URL 进行克隆,而是使用 https url 进行克隆。它要求提供凭据并且它起作用了。
小智 7
如果您在推送期间遇到任何问题(在 Windows 操作系统中),只需按照以下给定步骤删除缓存的 git 帐户: