# self(126) Host github.com port 22 User git HostName github.com PreferredAuthentications publickey IdentityFile ~/.ssh/id_rsa_github # company(FoxMail) Host gitlab.com port 22 User git HostName 你公司gitlab的地址,注意不需要带http:// PreferredAuthentications publickey IdentityFile ~/.ssh/id_rsa
测试连接
在命令行中分别运行以下两个命令,得出相同语句时说明连接成功
1 2 3 4
$ ssh -T git@github.com Hi zhangyangeng! You've successfully authenticated, but GitHub does not provide shell access. $ ssh -T git@gitlab.com Welcome to GitLab, @zhangyangeng!