Git配置多个SSH Key
查看已经生成的SSH Key
:
cat ~/.ssh/id_rsa.pub
生成一个新的ssh key:
ssh-keygen -t rsa -C 'xxx@dingtalk.com' -f ~/.ssh/codeup_id_rsa
同样可以查看新生成的ssh key:
cat ~/.ssh/codeup_id_rsa.pub
新建配置config:
touch ~/.ssh/config
# codeup.aliyun.com
Host codeup.aliyun.com
HostName codeup.aliyun.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/codeup_id_rsa
# gitee
Host gitee.com
HostName gitee.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa
测试验证:
ssh -T git@gitee.com
ssh -T git@codeup.aliyun.com