M1 芯片使用 Shadowrocket 和 Clash for windows 在终端环境下 GitHub 无法链接

167 天前
 xdtx

问题是这样的。

M1 的 MacBook 使用 Shadowrocket 下接入到互联网,在终端环境下push代码到GitHub出现报错,但是ping googlegithub都是正常的。push报错如下:

git push origin main
kex_exchange_identification: Connection closed by remote host
Connection closed by 198.18.0.21 port 22
fatal: Could not read from remote repository.

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

那么切换到 CFW 接入互联网,使用 git push origin main上传代码。就是正常的。

git push origin main
Everything up-to-date

但是ping googlegithub就是会超时,无法连接。

终端环境这个在我之前部署 ChatGPT 的时候我知道,CFW 不会接管终端的流量。

但理论上来讲,Shadowrocket 在终端环境下ping googlegithub都是正常。那么为什么无法 push 到 GitHub 呢?好迷惑。Shadowrocket 会和 iOS 上面的一样,只要规则内的网站都会走代理流量。

1126 次点击
所在节点    GitHub
3 条回复
tonytonychopper
167 天前
是不是你之前本地的代理端口号没有改?
sky96111
167 天前
ping 是 ICMP 流量,不会被代理转发,198.18.0.0/21 是 TUN/增强模式的 fake-ip 的地址段,是本机的地址,能 ping 通这个地址并不代表你能正常通过代理访问外网。
问题 2 同理,代理没有工作在 fake-ip 模式下,所以 ping 不通是正常的。
lostberryzz
167 天前
猜测你的机场屏蔽了落地机到 22 端口的连接,这是很多机场的一贯作坊,防止你通过机场的 IP 去扫描爆破。而小火箭接管了所有流量导致 git push 用不了,而用 CFW 终端走的是直连自然可以用。

另外 tun 模式下,ping google 和 github 都返回的是 fake ip ,并不代表真的能 ping 通。

开小火箭不能 git push ,解决办法是修改 git config ,让 github 走 443 端口,https://docs.github.com/en/authentication/troubleshooting-ssh/using-ssh-over-the-https-port

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/997072

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX