Git 从命令行注销用户
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/28238037/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Git log out user from command line
提问by byrdr
Is there a command for logging out of git? I'm turning my computer over to somebody else and don't want the git to be attached to my account in the terminal.
是否有退出 git 的命令?我正在将我的计算机转给其他人,并且不希望将 git 附加到我在终端中的帐户。
采纳答案by Alessandro Vendruscolo
Remove your SSH keys from ~/.ssh
(or where you stored them).
从~/.ssh
(或存储它们的位置)删除您的 SSH 密钥。
Remove your user settings:
删除您的用户设置:
git config --global --unset user.name
git config --global --unset user.email
git config --global --unset credential.helper
Or all your global settings:
或者你所有的全局设置:
git config --global --unset-all
Maybe there's something else related to the credentials store, but I always used git over SSH.
也许还有其他与凭证存储相关的东西,但我总是通过 SSH 使用 git。
回答by man guy
I came across this same problem, and the above answer didn't work for me because githubwas being fed my credentials through windows credential manager instead of git bash.
我遇到了同样的问题,上面的答案对我不起作用,因为github是通过 Windows 凭据管理器而不是 git bash 提供我的凭据。
You may have to check windows credential manager and delete the github entry under control panel > user accounts > credential manager > Windows credentials > Generic credentials
您可能需要检查 Windows 凭据管理器并删除下的 github 条目 control panel > user accounts > credential manager > Windows credentials > Generic credentials
回答by Seth D
On a Mac, credentials are stored in Keychain Access. Look for Github and remove that credential. More info: https://help.github.com/articles/updating-credentials-from-the-osx-keychain/
在 Mac 上,凭据存储在 Keychain Access 中。查找 Github 并删除该凭据。更多信息:https: //help.github.com/articles/updating-credentials-from-the-osx-keychain/
回答by Rao Pathangi
I am in a corporate setting and was attempting a simple git pull
after a recent change in password.
我在公司环境中,并git pull
在最近更改密码后尝试了一个简单的方法。
I got: remote: Invalid username or password.
我有: remote: Invalid username or password.
Interestingly, the following did not work: git config --global --unset credential.helper
有趣的是,以下方法不起作用: git config --global --unset credential.helper
I use Windows-7, so, I went to control panel -> Credential Manager -> Generic Credentials.
我使用 Windows-7,因此,我转到控制面板 -> 凭据管理器 -> 通用凭据。
From the credential manager list, delete the line items corresponding to git.
从凭证管理器列表中,删除与 git 对应的行项目。
After the deletion, come back to gitbash and git pull should prompt the dialog for you to enter your credentials.
删除后,回到 gitbash 并且 git pull 应该会提示对话框让你输入你的凭据。
回答by Diego Sayron
I was not able to clone a repository due to have logged on with other credentials.
由于使用其他凭据登录,我无法克隆存储库。
To switch to another user, I >>desperate<< did:
为了切换到另一个用户,我 >>desperate<< 做了:
git config --global --unset user.name
git config --global --unset user.email
git config --global --unset credential.helper
after, instead using ssh link, I used HTTPS link. It asked for credentials and it worked fine FOR ME!
之后,我使用 HTTPS 链接,而不是使用 ssh 链接。它要求提供凭据,对我来说效果很好!
回答by Shubham Bhardwaj
If you are facing any issues during push ( in windows OS), just remove the cached git account by following the given steps below: 1. Search for Control panel and open the same. 2. Search for Credential Manager and open this. 3. Click on Windows Credentials under Manage your credentials page. 4. Under Generic Credentials click on GitHub. 5. Click on Remove and then confirm by clicking Yes button. 6. Now start pushing the code and you will get GitHub popup to login again and now you are done. Everything will work properly after successful login.
如果您在推送过程中遇到任何问题(在 Windows 操作系统中),只需按照以下给定步骤删除缓存的 git 帐户: 1. 搜索控制面板并打开它。2. 搜索 Credential Manager 并打开它。3. 单击管理您的凭据页面下的 Windows 凭据。4. 在通用凭证下单击 GitHub。5. 单击“删除”,然后单击“是”按钮进行确认。6. 现在开始推送代码,你会得到 GitHub 弹出窗口再次登录,现在你完成了。登录成功后一切正常。
回答by user2486738
Try this on Windows:
在 Windows 上试试这个:
cmdkey /delete:LegacyGeneric:target=git:https://github.com