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

后端 未结 11 2154
长发绾君心
长发绾君心 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 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.

提交回复
热议问题