问题描述
我有两个 github 帐户,一个用于工作,一个用于家庭.我正在处理一个个人项目并且无法推送到 origin master,因为它说我仍然登录到我的工作帐户.
I have two github accounts, one for work one for home. I am working on a personal project and can't push to origin master because it says I'm still logged in to my work account.
我重置了我的全局用户/user.name/user.email/user.token,但它仍然注册了我的工作帐户.
I reset my global user / user.name / user.email / user.token and it still registers my work account.
这不会那么难吗?
谢谢
推荐答案
GitHub 令牌 仅用于非 ssh 通信.
The GitHub token is only used for non-ssh communications.
但是如果您使用 https 地址推送到 GitHub,并且仍然注册为您的第一个帐户而不是第二个帐户,这应该意味着您没有在第二个帐户上引用与您的公钥匹配的正确公钥/私钥.
例如,请参阅博客文章快速提示:如何使用 GitHub 和多个帐户",它通过 ssh 配置文件管理这些公钥/私钥:
But if you are pushing to GitHub using https address, and still register as your first account instead of the second one, that should mean you don't refer to the right public/private keys matching your public key on second account.
See, for instance, the blog post "Quick Tip: How to Work with GitHub and Multiple Accounts", which manages those public/private keys through a ssh config file:
#Default GitHub
Host github.com
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa
Host github-COMPANY
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa_COMPANY
这篇关于更改 github 帐户 mac 命令行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!