生成一个 a SSH-Key:
$ ssh-keygen -t rsa -C 'xxxxx@youkuaiyun.com' -f ~/.ssh/a_id_rsa
生成一个 b SSH-Key:
$ ssh-keygen -t rsa -C 'xxxxx@qq.com' -f ~/.ssh/b_id_rsa
在 ~/.ssh 目录下新建一个 config 文件,添加如下内容(其中Host和HostName填写git服务器的域名,IdentityFile指定私钥的路径)
# a
Host xxx.com
HostName xxx.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/a_id_rsa
# b
Host yyy.com
HostName yyy.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/b_id_rsa
4.用ssh命令分别测试
$ ssh -T xxx