V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
git
Pro Git
Atlassian Git Tutorial
Pro Git 简体中文翻译
GitX
arrowna
V2EX  ›  git

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

  •  
  •   arrowna · 2016-06-04 21:26:36 +08:00 · 6198 次点击
    这是一个创建于 2874 天前的主题,其中的信息可能已经有所发展或是发生改变。
    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 条回复    2016-06-05 19:08:16 +08:00
    owt5008137
        1
    owt5008137  
       2016-06-04 21:32:58 +08:00 via Android
    可以的,设置环境变量
    freaks
        2
    freaks  
       2016-06-04 21:46:37 +08:00
    FlowMEMO
        3
    FlowMEMO  
       2016-06-04 21:47:16 +08:00
    arrowna
        4
    arrowna  
    OP
       2016-06-04 22:56:11 +08:00
    @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  
       2016-06-04 23:06:55 +08:00
    echo 202.86.162.172 chromium.googlesource.com >> %WINDIR%\system32\drivers\etc\hosts
    FlowMEMO
        6
    FlowMEMO  
       2016-06-04 23:36:21 +08:00
    @arrowna 你先随便克隆个 github 上的 repo 试试看看是不是设置问题, 我这里试了 clone chromium 可以开始下载.
    arrowna
        7
    arrowna  
    OP
       2016-06-04 23:46:42 +08:00
    @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

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

    另外执行 git config --global --get http.proxy 看看你的代理设置对了没有,我用 ss 的设置的是 socks5://localhost:1080
    kiwi95
        11
    kiwi95  
       2016-06-05 16:32:56 +08:00 via Android
    Windows 下试试 proxifier 添加规则
    UnisandK
        12
    UnisandK  
       2016-06-05 19:08:16 +08:00
    直接上 proxifier 吧,或者免费的 sockscap64
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3266 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 12:41 · PVG 20:41 · LAX 05:41 · JFK 08:41
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.