多个git库的ssh配置

时间:2023-03-10 04:22:16
多个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