V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
xdtx
V2EX  ›  GitHub

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

  •  
  •   xdtx · 150 天前 · 1076 次点击
    这是一个创建于 150 天前的主题,其中的信息可能已经有所发展或是发生改变。

    问题是这样的。

    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 上面的一样,只要规则内的网站都会走代理流量。

    3 条回复    2023-12-02 14:45:03 +08:00
    tonytonychopper
        1
    tonytonychopper  
       150 天前
    是不是你之前本地的代理端口号没有改?
    sky96111
        2
    sky96111  
       150 天前
    ping 是 ICMP 流量,不会被代理转发,198.18.0.0/21 是 TUN/增强模式的 fake-ip 的地址段,是本机的地址,能 ping 通这个地址并不代表你能正常通过代理访问外网。
    问题 2 同理,代理没有工作在 fake-ip 模式下,所以 ping 不通是正常的。
    lostberryzz
        3
    lostberryzz  
       150 天前   ❤️ 1
    猜测你的机场屏蔽了落地机到 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
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2620 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 14:14 · PVG 22:14 · LAX 07:14 · JFK 10:14
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.