一、生产密钥
1.1、打开命令行,生产第1个ssh key。
ssh-keygen -t rsa -C "xx@qq.com"
1.2、打开命令行,生产第2个ssh key。
ssh-keygen -t rsa -f ~/.ssh/id_rsa_other -C "xx@qq.com"
1.3、在目录~/.ssh/下创建config文件。
Host github.com
HostName github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa
User xx
Host gitee.com
HostName gitee.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa_other
User xx
二、阿里云多个账号配置
2.1、修改config文件
host codeup.aliyun.com
HostName codeup.aliyun.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa_ali1
User xxx
IdentityAgent none
IdentitiesOnly yes
Host ali2
HostName codeup.aliyun.com
IdentityFile ~/.ssh/id_rsa_ali2
User xxx
IdentityAgent none
IdentitiesOnly yes
Host ali3
HostName codeup.aliyun.com
IdentityFile ~/.ssh/id_rsa_ali3
User xxx
IdentityAgent none
IdentitiesOnly yes