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.
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
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
.
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
The following solved the problem for me
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 tocurl
without any preprocessing socurl
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 forcescurl
to fall back to detecting the proxy configuration from the environment, causing thehttp.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.
This error may occur if proxy credentials are given, but invalid. In my case, it was an old password.