ssh-key - 多个 github 账号,怎样配置对应的 SSH key
怪我咯
怪我咯 2017-04-28 09:03:57
0
2
564

我有多个 github 账号,分别设置了不同的 SSH key,one_rsatwo_rsa
那么,在对 git 项目进行操作时,如何保证不冲突呢?

怪我咯
怪我咯

走同样的路,发现不同的人生

reply all(2)
迷茫

Use ssh config(ssh_config Recipes). In the .ssh 目录下新建一个 config file, configure different keys for different Hosts. For example:

Host gitcafe.xxx
HostName gitcafe.com
User git
IdentityFile ~/.ssh/id_rsa_gitcafe_xxx

Host gitcafe.yyy
HostName gitcafe.com
User git
IdentityFile ~/.ssh/id_rsa_gitcafe_yyy

Host github.xxx
HostName github.com
IdentityFile ~/.ssh/id_rsa_github_xxx
# 此行是代理配置,请无视
ProxyCommand ~/.ssh/socksproxywrapper.sh %h %p

For example, id_rsa_github_xxx 是你在 githubxxx the user’s key can be used

git clone git@github.xxx:xxx/project.git

This way to pull items on github.

淡淡烟草味

Ssh can configure the host in ~/.ssh/config

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template