我有2个GitHub帐户:
帐号1
account2
在account2中,我被添加为某个存储库的协作者:
account_notmine / repo_xyz
我已经为第二个帐户创建并添加了一个新的ssh密钥,并将其添加到了github上。
Host github.com
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa
Host github-new
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa_new
现在,如果我尝试在我的account2的一个个人存储库中工作,它可以正常工作。但是,当我尝试克隆我作为合作伙伴的回购协议时,它将无法正常工作。
基本上,我正在做的就是尝试执行以下命令:
git clone --bare git@github-new:account_notmine/repo_xyz.git
它给我的错误是:
Cloning into bare repository 'repo_xyz.git'...
Warning: Permanently added 'github.com,xxx.xxx.xxx.xxx' (RSA) to the list of known hosts.
ERROR: Repository not found.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
我究竟做错了什么?
解决:仅通过SSH调用我的github第二个帐户(ssh -T git @ github-new),我发现它回答了我:
Hi **account1**! You've successfully authenticated, but GitHub does not
# provide shell access.
然后,我编辑了ssh配置文件,添加了IdentitiesOnly yes语句:
Host github.com
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa
IdentitiesOnly yes
Host github-smartstay
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa_new
IdentitiesOnly yes
好吧,它奏效了。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句