git如何识别我的github帐户

时间:2017-02-03 06:05:51

标签: git github ssh

由于我想使用多个GitHub帐户,因此我为第二个帐户创建了SSH密钥对。 我添加

#Default GitHub
Host github.com
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa

Host github-secondaccount
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa_secondaccount
正如教程所说,

到我的ssh配置。(虽然我没有文件id_rsa) 在那之后,我明白了,如果我将github.com的IdentityFile更改为~/.ssh/id_rsa_secondaccount?,该怎么办 因为我想在https instead of ssh上推送到github。 但是git仍告诉我,

  

remote:允许secondaccount / xxxx.git拒绝firstaccount。

我的第一个帐户甚至没有id_rsa文件。

git如何将我视为第一个帐户? 感谢

1 个答案:

答案 0 :(得分:0)

  

我想通过https而不是ssh推送到github。

然后你需要修改你的git存储库的URL,这样它就可以在.git/config中使用HTTPS代替SSH,而不是像

那样
url = git@github.com:Jakuje/stuff.git

url = https://github.com/Jakuje/stuff.git
相关问题