Git through a Proxy. What is causing the 407 error when cloning?

后端 未结 11 2138
长发绾君心
长发绾君心 2020-12-08 16:20

I\'m trying to use Git through a proxy. I\'ve tried setting parameters \'git config --global\' in a lot of ways but always without success when cloning repositories.

相关标签:
11条回答
  • 2020-12-08 16:59

    If you're already behind a proxy and getting this error, you will have to clear http.proxy and https.proxy: git config --global --unset http.proxy git config --global --unset https.proxy

    0 讨论(0)
  • 2020-12-08 17:00

    You can enable trace logging to get more information about what Git is doing. Following is an example:

    GIT_TRACE=$HOME/trace.log git co master
    

    You must use absolute paths if you want to send output to a file. Otherwise, use true or 1 to send output to standard error; e.g. GIT_TRACE=1.

    0 讨论(0)
  • 2020-12-08 17:04

    This works for users on a domain and behind proxy with authentication and HTTPS inspection. Use the following where the %5c is used instead of "\". ie. DOMAIN%5cusername@proxy:port

    Open GIT config in editor by entering below command:

    git config --global -e     
    

    Add/update following sections and save:

    [http]
        proxy = http://domain%5cusername:password@proxy:port
        sslVerify = false
    [https]
        proxy = http://domain%5cusername:password@proxy:port
        sslVerify = false
    
    0 讨论(0)
  • 2020-12-08 17:05

    The following solved the problem for me

    1. Rightclick on the git folder-> TortoiseGit->Settings->Network
    2. Enable Proxy Server and input proxy, port, user, password
    0 讨论(0)
  • 2020-12-08 17:06

    Note that for any Git between 2.8 (February 2016, five years after the OP's question) and Git 2.13 (Q2 2017), an invalid proxy configuration would be silently ignored (not even a 407)

    See commit ae51d91, commit 5741508 (11 Apr 2017) by Sergey Ryazanov (acteek).
    Helped-by: Jeff King (peff).
    (Merged by Junio C Hamano -- gitster -- in commit 6b51cb6, 24 Apr 2017)

    http: fix the silent ignoring of proxy misconfiguraion

    Earlier, the whole http.proxy option string was passed to curl without any preprocessing so curl could complain about the invalid proxy configuration.

    After the commit 372370f ("http: use credential API to handle proxy authentication", 2016-01-26), if the user specified an invalid HTTP proxy option in the configuration, then the option parsing silently fails and NULL will be passed to curl as a proxy.
    This forces curl to fall back to detecting the proxy configuration from the environment, causing the http.proxy option ignoring.

    Fix this issue by checking the proxy option parsing result. If parsing failed then print an error message and die.
    Such behaviour allows the user to quickly figure the proxy misconfiguration and correct it.

    0 讨论(0)
  • 2020-12-08 17:11

    This error may occur if proxy credentials are given, but invalid. In my case, it was an old password.

    0 讨论(0)
提交回复
热议问题