$ git push
ssh: connect to host github.com port 22: Operation timed out
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
- 先测试可用性
ssh -T -p 443 git@ssh.github.com
如果出现下面提示说明可用
Hi XXXX! You've successfully authenticated, but GitHub does not provide shell access.
如果出现下面的提示,直接输入yes回车即可
The authenticity of host '[ssh.github.com]:443 ([20.205.243.160]:443)' can't be established.
...
...
Are you sure you want to continue connecting (yes/no/[fingerprint])?
- 创建或修改 ~/.ssh/config 加入以下内容
$ vim ~/.ssh/config
Host github.com
Hostname ssh.github.com
Port 443
- 再次测试,出现下面信息就说明成功了
ssh -T git@github.com
Hi XXXX! You've successfully authenticated, but GitHub does not provide shell access.
评论区