最近在git push时总是报错,排除网络被墙的可能后,找到了一种非常有效的解决办法:使用 ssh 443端口。
报错
ssh: connect to host github.com port 22: Connection timed out
fatal: Could not read from remote repository.
解决方法 github官网原文
1.测试可用性
终端运行 ssh -T -p 443 git@ssh.github.com
,若提示successfully authenticated
即可继续下一步。
2.编辑 ~/.ssh/config 文件
终端运行 vim ~/.ssh/config
添加以下内容:
Host github.com
Hostname ssh.github.com
Port 443
这里涉及到vim/vi的基本操作, 点击了解
3.测试连接是否有效
终端运行 ssh -T git@github.com
successfully 即成功。