V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
ThanksSirAlex
V2EX  ›  问与答

git clone 代理没用怎么破

  •  
  •   ThanksSirAlex · 2020-03-15 22:51:08 +08:00 · 2894 次点击
    这是一个创建于 1492 天前的主题,其中的信息可能已经有所发展或是发生改变。

    我直接连到代理服务器上 git clone 很快,但是在本地设置了 http.proxy 以后一点都没加速,这个怎么破

    13 条回复    2020-03-16 21:51:25 +08:00
    wangsongyan
        1
    wangsongyan  
       2020-03-15 23:00:40 +08:00 via iPhone
    https_proxy
    lmoon
        2
    lmoon  
       2020-03-15 23:01:52 +08:00 via Android
    git:// 开头的协议要另外设置代理
    ThanksSirAlex
        3
    ThanksSirAlex  
    OP
       2020-03-15 23:03:23 +08:00
    @lmoon 但是我用的是 https,没有 git://
    ThanksSirAlex
        4
    ThanksSirAlex  
    OP
       2020-03-15 23:03:41 +08:00   ❤️ 1
    @wangsongyan 这个我也设置了,没用
    jimliang
        5
    jimliang  
       2020-03-15 23:05:58 +08:00
    http.proxy https.proxy 都设置了没
    QingStone
        6
    QingStone  
       2020-03-16 01:35:57 +08:00 via Android
    是 Windows 平台吗?
    VDarker
        7
    VDarker  
       2020-03-16 01:37:57 +08:00 via Android
    有个别的办法 用 gitee 中转下
    royzheng
        8
    royzheng  
       2020-03-16 02:00:36 +08:00   ❤️ 2
    如果你非 windows 平台的话 在~/.ssh/config 里设置下
    Host github.com
    HOSTNAME github.com
    User git
    ProxyCommand nc -X 5 -x 127.0.0.1:1080 %h %p

    1080 端口换成你本地的 ss client socks 端口
    learningman
        9
    learningman  
       2020-03-16 02:30:47 +08:00 via Android
    @VDarker 有 submodule 就废了
    kumiko
        10
    kumiko  
       2020-03-16 08:48:08 +08:00 via Android
    我用 hosts 大法,懒得再装别的东西
    lniwn
        11
    lniwn  
       2020-03-16 09:11:08 +08:00
    proxychains4
    ysc3839
        12
    ysc3839  
       2020-03-16 13:42:14 +08:00 via Android
    还要设置 https.proxy,不然 https 协议不会走代理。
    ewex
        13
    ewex  
       2020-03-16 21:51:25 +08:00   ❤️ 1
    Clone with HTTPS
    git config --global http.proxy http://127.0.0.1:1080
    git config --global http.proxy socks5://127.0.0.1:1080
    git config --global http.proxy socks5h://127.0.0.1:1080

    飞机代理,以上 3 种任选 1 种,我自己用的第 3 种。
    另外没有 https.proxy 设置,不要听信上面有些人说的。
    Arch Linux、CentOS 8 实测没问题,其他发行版应该也没问题。

    Clone with SSH
    echo "Host github.com" >> ~/.ssh/config
    echo "ProxyCommand nc -X 5 -x 127.0.0.1:1080 %h %p" >> ~/.ssh/config

    上面的 IP、端口、域名换成对应正确的就好
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5519 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 06:47 · PVG 14:47 · LAX 23:47 · JFK 02:47
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.