This question already has an answer here:
-
How do I pull from a Git repository through an HTTP proxy?
26 answers
I am using msysgit from behind a proxy. As I said in question Getting git to work with a proxy server
I have set system variable http_proxy
to a value. Later I call
git config --global http.proxy $http_proxy
However, if I call something like:
git clone git://git.savannah.gnu.org/gnuprologjava.git
It gives the following error:
git.savannah.gnu.org[0; 140.186.70.72]: errno=No error
fatal: unable to connect a socket (No error)
If you're behind an http proxy, you should be using http git urls. The UsingGit page on Savannah.gnu.org tells you the correct syntax for this. For that repo:
git clone http://git.savannah.gnu.org/r/gnuprologjava.git
When you are on linux, see this page.
On windows I have solved it this way;
Install Cygwin, and select the socat package. Create a script gitproxy.cmd and save it in the path (I used C:\msysgit\cmd\gitproxy.cmd):
@echo off
C:\cygwin\bin\socat.exe - PROXY:192.168.100.1:\%1:\%2,proxyport=3128
(replace 192.168.100.1 and 3128 with your own proxy ip/port)
Execute the following line to configure the proxy:
git config --global core.gitproxy gitproxy.cmd
Note that the proxy server must accept the CONNECT command for the git port (9418). I have added the following lines to the squid configuration to make this work:
acl SSL_ports port 9418 # git
acl Safe_ports port 9418 # git
(ie configure port 9418 the same way as port 443 in the proxy server)
As this was answered by many but this is just for a Windows USER who is behind a proxy with auth.
Re-Installing (first failed, don't remove).
Go to:
1. msysgit\installer-tmp\etc\gitconfig
Under [http]
proxy = http://user:pass@url:port
2. msysgit\installer-tmp\setup-msysgit.sh
export HTTP_PROXY="http://USER:PASS@proxy.abc.com:8080"
if you have any special char in user/pass use url_encode
Option 2:
Set environment variable
HTTP_PROXY=http://proxy.com:8080