git ssh 多主机配置配置

ssh配置

#vi ~/.ssh/config
Host domain/ip
#   ForwardAgent no
#   ForwardX11 no
#   PasswordAuthentication yes
#   HostbasedAuthentication no
#   GSSAPIAuthentication no
#   GSSAPIDelegateCredentials no
#   BatchMode no
#   CheckHostIP yes
#   AddressFamily any
#   ConnectTimeout 0
#   StrictHostKeyChecking ask
#   IdentityFile ~/.ssh/gitlab_ecdsa
#   Port 22
#   Protocol 2

#一般这样配置就可以了
Host domain/ip
    IdentityFile ~/.ssh/gitlab_ecdsa

#可以配置多个域名
Host gitlab.com
    IdentityFile ~/.ssh/gitlab_ecdsa

Host github.com
    IdentityFile ~/.ssh/github_ecdsa

#测试是否生效
$ ssh -T git@gitlab.com
Welcome to GitLab, haha!
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容