多个git库的ssh配置

当拥有多个git服务器,而且都是用ssh认证方式时,需要在~/.ssh下的config文件做如下配置

如下:第一个为本地git库,第二个为github库,第三个为默认git库

Host 192.168.1.12
  IdentityFile ~/.ssh/ying
  User ying

Host github.com
IdentityFile ~/.ssh/id_rsa.another
User anotherUser

Host *
 AddKeysToAgent yes
 UseKeychain yes
 IdentityFile ~/.ssh/id_rsa
---栖息之鹰(一个外表懒洋洋的内心有激情的程序员) 此博客为笔者原著,转载时请注明出处,谢谢!
原文地址:https://www.cnblogs.com/roostinghawk/p/10528156.html