当电脑连接手机热点(中国移动)时,push 到 GitHub 出现
通过ssh -vT git@github.com
进行 debug,报错
ssh_dispatch_run_fatal: Connection to xxxxxxx port 22: Operation timed out
GitHub Troubleshooting :建议通过HTTPS端口进行SSH 连接
- 测试是否可以通过HTTPS端口进行SSH
ssh -T -p 443 git@ssh.github.com
- 如果可行,添加
~/.ssh/config
改用 HTTPS 连接
1
2
3 Host github.com
Hostname ssh.github.com
Port 443
执行第一步,仍然报错 ssh_dispatch_run_fatal: Connection to xxxxxxxxx port 443: Operation timed out
三种解决方案
1 添加 hosts (不好使)
可以在 https://www.ipaddress.com 查询 GitHub 的 IP,一般查询
- github.com
- assets-cdn.github.com
- github.global.ssl.fastly.net
添加到 hosts 之后就不经过 DNS 解析,先从 hosts 开始执行。
$ sudo vi /etc/hosts
1 | ## |
2 墙(*_*)
3 Push or Clone 直接改用 HTTPS(推荐)
推送的仓库地址改用 HTTPS 方式,例如https://github.com/AshinWang/AshinWang.github.io.git
推送过程中,需要键入 UserName 和 Password 。