V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
git
Pro Git
Atlassian Git Tutorial
Pro Git 简体中文翻译
GitX
arrowna
V2EX  ›  git

windows 下可以为 git 设置代理么?

  •  
  •   arrowna · Jun 4, 2016 · 6819 views
    This topic created in 3614 days ago, the information mentioned may be changed or developed.
    e:\chrome>git clone https://chromium.googlesource.com/chromium/tools/depot_tools
    Cloning into 'depot_tools'...
    fatal: unable to access 'https://chromium.googlesource.com/chromium/tools/depot_tools/': Connection timed out after 300028 milliseconds

    貌似要番茄才能下载。。。
    12 replies    2016-06-05 19:08:16 +08:00
    owt5008137
        1
    owt5008137  
       Jun 4, 2016 via Android
    可以的,设置环境变量
    arrowna
        4
    arrowna  
    OP
       Jun 4, 2016
    @owt5008137
    @freaks
    @FlowMEMO

    设置了,还是无法下载代码。。。
    e:\chrome>git clone https://chromium.googlesource.com/chromium/src
    Cloning into 'src'...
    fatal: unable to access 'https://chromium.googlesource.com/chromium/src/': Failed to connect to chromium.googlesource.com port 443: Timed out
    LGA1150
        5
    LGA1150  
       Jun 4, 2016
    echo 202.86.162.172 chromium.googlesource.com >> %WINDIR%\system32\drivers\etc\hosts
    FlowMEMO
        6
    FlowMEMO  
       Jun 4, 2016
    @arrowna 你先随便克隆个 github 上的 repo 试试看看是不是设置问题, 我这里试了 clone chromium 可以开始下载.
    arrowna
        7
    arrowna  
    OP
       Jun 4, 2016
    @FlowMEMO github 不用代理也可以下载啊。。

    git clone https://github.com/jquery/jquery
    Cloning into 'jquery'...
    remote: Counting objects: 41300, done.
    remote: Compressing objects: 100% (29/29), done.
    Receiving objects: 8% (3547/41300), 780.01 KiB | 126.00 KiB/s

    可以下载哦
    O3YwA1ENkb7i35XJ
        8
    O3YwA1ENkb7i35XJ  
       Jun 5, 2016
    在执行 clone 之前使用
    set http_proxy=http://xxx.xxx.xxx.xxx:1234
    set https_proxy=https://xxx.xxx.xxx.xxx:1234
    来设置一下这两个环境变量, git 会自动使用环境变量中指定的代理的.
    xmgit
        9
    xmgit  
       Jun 5, 2016
    貌似人家说的是 windows 下终端中运行 git 的代理。
    需要告知 windows 下用的什么终端,直接配置终端代理。
    FlowMEMO
        10
    FlowMEMO  
       Jun 5, 2016
    @arrowna 我的意思是你先试试是不是代理的问题.
    比如我 git 中设置好代理后的表现是:
    开代理, github 和 chromium 均可下,速度快
    不开代理, github 和 chromium 均不可下

    另外执行 git config --global --get http.proxy 看看你的代理设置对了没有,我用 ss 的设置的是 socks5://localhost:1080
    kiwi95
        11
    kiwi95  
       Jun 5, 2016 via Android
    Windows 下试试 proxifier 添加规则
    UnisandK
        12
    UnisandK  
       Jun 5, 2016
    直接上 proxifier 吧,或者免费的 sockscap64
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1223 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 46ms · UTC 17:51 · PVG 01:51 · LAX 10:51 · JFK 13:51
    ♥ Do have faith in what you're doing.