通过添加多密钥实现
- ssh-agent bash
- ssh-keygen -t rsa -C 'xx1' -f ~/.ssh/id_rsa_xx1
- ssh-keygen -t rsa -C 'xx2' -f ~/.ssh/id_rsa_xx2
- ssh-add id_rsa_xx1
- ssh-add id_rsa_xx2
vim ~/.ssh/config
shell
Host github_xx1
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa_xx1
Host github_xx2
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa_xx2
- ssh -T -ai ~/.ssh/id_rsa_xx1 git@github_xx1
- ssh -T -ai ~/.ssh/id_rsa_xx2 git@github_xx2