Windows GitBash解决Github添加密钥时提示Key is already in use的问题

通过添加多密钥实现

  • 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

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

你可能感兴趣的:(github)