在一台电脑生成两份ssh密钥、公钥映射两个GitHub账号

在一台电脑生成两份ssh密钥、公钥映射两个GitHub账号

设置sshkey one

ssh-keygen -t rsa -C "xxxx@xxx.com"

设置sshkey two

ssh-keygen -t rsa -f ~/.ssh/id_rsa_2 -C "xxxx@xxx.com"

将.pub的内容设置到对应github上

新增文件config在.ssh文件夹下

配置内容

#default                                                                       
Host gitlab.xxx.com
HostName gitlab.xxx.com
User git
IdentityFile ~/.ssh/id_rsa
#two                                                                           
Host github.com
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa_2
posted @ 2021-03-26 16:06  大道至简、  阅读(176)  评论(0)    收藏  举报