电脑添加多个SSH key

创建新得ssh key

ssh-keygen -t rsa -C "excem@excemple" -f ~/.ssh/id_rsa.gitlab

编辑config

vim ~/.ssh/config
# gitee
Host gitee.com
HostName gitee.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa.gitee

# github
Host github.com
HostName github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa.github

# gitlab
Host gitlab.com
HostName gitlab.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa.gitlab

测试

ssh -T git@gitlab.com
posted @ 2020-07-02 17:28  1994的地铁  阅读(173)  评论(0)    收藏  举报