前置

本人在执行git push/pull时持续报错如下:

1
2
3
4
ssh: connect to host github.com port 22: Connection timed out 
fatal: Could not read from remote repository.

Please make sure you have the correct access rights and the repository exists.

既然22端口无法连接,那就直接改为443端口。

解决

终端直接编辑ssh配置:

1
nano ~/.ssh/config

加入:

1
2
3
Host github.com
Hostname ssh.github.com
Port 443

重新执行,ssh应该已经可以正常建立连接。