ClashX Pro 开启增强模式后 Git 连接不上 GitHub
代理软件如何实现真全局代理或对指定应用代理? - 干志雄的博客 这篇文章中讲了通过 ClashX Pro 开启增强模式来显示真全局代理,但是开启后会导致 Git 连接不上 GitHub 的问题。
| 1 | $ ssh -T git@github.com | 
增强模式是利用 TUN ,创建虚拟网卡改路由表优先走这块虚拟网卡接管所有流量。IP 28.0.0.101 是虚拟 IP,目的是为了接管系统流量。
这个问题的原因就是某些节点因为安全问题禁用了 22 端口,而 SSH 默认使用的就是 22 端口,因此连接就会被拒绝。解决方法就是把 22 端口换成 443 端口,即通过 HTTPS 端口建立的 SSH 连接。
解决方法
- 测试通过 HTTPS 端口的 SSH 是否能连接,也就是 SSH 能否通过 443 端口连接到 - git@ssh.github.com.- 1 
 2
 3
 4
 5
 6
 7
 8
 9- $ ssh -vT -p 443 git@ssh.github.com 
 OpenSSH_8.6p1, LibreSSL 3.3.6
 debug1: Reading configuration data /Users/gan/.ssh/config
 debug1: Reading configuration data /etc/ssh/ssh_config
 debug1: /etc/ssh/ssh_config line 21: include /etc/ssh/ssh_config.d/* matched no files
 debug1: /etc/ssh/ssh_config line 54: Applying options for *
 debug1: Authenticator provider $SSH_SK_PROVIDER did not resolve; disabling
 debug1: Connecting to ssh.github.com port 443.
 debug1: Connection established.- 可以看到连接没有问题。 
- 在 SSH 配置文件中设置此行为。 - ~/.ssh/config - 1 
 2
 3
 4- Host github.com 
 Hostname ssh.github.com
 Port 443
 User git
- 验证。 - 1 
 2- $ ssh -T git@github.com 
 Hi GanZhiXiong! You've successfully authenticated, but GitHub does not provide shell access.- 可以看到成功了,问题解决。 
参考
ClashX Pro 开启增强模式后 Git 连接不上 GitHub

