在 GitHub 和 GitLab 添加本机 SSH Public Key 之后,依旧存在不能访问的情况,解决办法如下:
$ touch ~/.ssh/config$ chmod 600 ~/.ssh/config
在 .ssh/config 文件中添加以下内容:
Host github.comHostName github.comUser gitPort 22IdentityFile ~/.ssh/id_gitHost git.mygitlab.comHostName git.mygitlab.comUser gitPort 22IdentityFile ~/.ssh/id_git
检测 GitHub 是否可以正常连接:
$ ssh -T git@github.comHi mingminyu! You've successfully authenticated, but GitHub does not provide shell access.
