由于公司只给了gitlab的ssh-key,但是在自己的本子上还有Github等SSH-Key,所以需要单独去配置
.
|____config
|____id_rsa
|____company_rsa
需要在用户目录的.ssh文件夹下创建一个config的文件,内容如下
# github.com
Host github.com
HostName github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa
# gitlab.company.net
Host gitlab.company.net
HostName gitlab.company.net
PreferredAuthentications publickey
IdentityFile ~/.ssh/company_rsa
根据Git地址的不同可以对其指定不同的ssh-key
1 条评论
先收藏了 感谢分享