第一步

创建~/.ssh/conf文件,添加如下配置

  1. Host gitee.com
  2. HostName gitee.com
  3. PreferredAuthentications publickey
  4. IdentityFile ~/.ssh/id_rsa_me
  5. Host gitlab.com
  6. HostName gitee.com
  7. PreferredAuthentications publickey
  8. IdentityFile ~/.ssh/id_rsa_work
  • Host声明域名
  • IdentityFile指定秘钥文件
  • 如果没有指定域名则读取默认秘钥文件id_rsa