linux – 如何在github上为1个用户添加2个repo的部署密钥

我创建一个部署用户,生成一个ssh_key,我将id_rsa.pub添加为 github部署密钥.

这个部署用户需要拉2个repo,所以我将相同的ssh_key作为部署密钥添加到另一个repo.

但github告诉我,部署密钥已经在使用中.

我不知道如何为1个用户添加2个id_rsa.pub.

更新:

我添加了额外的id_rsa_assets,但我仍然无法拉.

ssh-add .ssh/id_rsa_assets

无法打开与身份验证代理的连接.

的.ssh /配置

Host guardians
    Hostname github.com
    User git
    IdentityFile ~/.ssh/id_rsa

Host assets
    Hostname github.com
    User git
    IdentityFile ~/.ssh/id_rsa_assets

解决方法

您可以使用您想要的任何名称创建两个公钥/私钥:
~/.ssh
  repo1
  repo1.pub
  repo2
  repo2.pub

  config

(即,如果您指示ssh在哪里查找,则不必将其命名为id_rsa(.pub).
这就是’config’发挥作用的地方:配置文件包含GitHub repo1和GitHub repo2的两个连接的名称,对于每个连接,包含私有repo密钥的路径,如“change github account mac command line”和“Quick Tip: How to Work with GitHub and Multiple Accounts”中所述“:

Host githubRepo1
HostName github.com
User git
IdentityFile ~/.ssh/repo1

Host githubRepo2
HostName github.com
User git
IdentityFile ~/.ssh/repo2

这样,只要您使用他们的ssh地址,您就可以从两个仓库中的任何一个撤出.

相关文章

文章浏览阅读1.8k次,点赞63次,收藏54次。Linux下的目录权限...
文章浏览阅读1.6k次,点赞44次,收藏38次。关于Qt的安装、Wi...
本文介绍了使用shell脚本编写一个 Hello
文章浏览阅读1.5k次,点赞37次,收藏43次。【Linux】初识Lin...
文章浏览阅读3k次,点赞34次,收藏156次。Linux超详细笔记,...
文章浏览阅读6.8k次,点赞109次,收藏114次。【Linux】 Open...