如何在github上为1用户添加2回购的部署密钥 [英] how to add deploy key for 2 repo with 1 user on github
问题描述
我创建了一个部署
用户,生成一个ssh_key,我将id_rsa.pub添加为github deploy key。
I create a deploy
user, generate an ssh_key, I add id_rsa.pub as github deploy key.
$ this $ deploy
用户需要拉2回购,所以我添加到另一个回购作为部署密钥相同的ssh_key。
this deploy
user need pull 2 repo, so I add the same ssh_key to another repo as deploy key.
但github告诉我,部署密钥已被使用。
but github tell me, deploy key already in use.
我不知道如何为1个用户添加2个id_rsa.pub。
and I don't know how add 2 id_rsa.pub for 1 user.
我增加了id_rsa_assets,但仍然无法取消。
I add id_rsa_assets additional, but I still cannot pull.
ssh-add .ssh/id_rsa_assets
无法打开连接到您的身份验证代理。
Could not open a connection to your authentication agent.
.ssh / config
.ssh/config
Host guardians
Hostname github.com
User git
IdentityFile ~/.ssh/id_rsa
Host assets
Hostname github.com
User git
IdentityFile ~/.ssh/id_rsa_assets
推荐答案
您可以用任何名字创建两个公钥/私钥你想:
You can create two public/private keys with whatever name you want:
~/.ssh
repo1
repo1.pub
repo2
repo2.pub
config
(即它没有命名为 id_rsa(.pub)
即可工作,前提是您指示ssh在哪里查看。
这就是' config
'起作用: config
文件包含GitHub的两个连接的名称 repo1
和GitHub repo2
,为每个连接指定私人回购密钥的路径,如更改github帐户mac命令行和快速提示:如何使用GitHub和多个帐户:
(Ie it doesn't have to be named id_rsa(.pub)
to work, provided you indicate ssh where to look.
That is where 'config
' comes into play: the config
file includes the name of your two connections for GitHub repo1
and GitHub repo2
with, for each connection, the path to your private repo key, as described in "change github account mac command line" and in "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地址即可。
That way you can pull from any of the two repos, as long as you are using their ssh addresses.
这篇关于如何在github上为1用户添加2回购的部署密钥的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!