Getting Git to work with a proxy server - fails with "Request timed out"
How do I get Git to use a proxy server?
I need to check out code from a Git server, but it shows "Request timed out" every time. How do I get around this?
Alternatively, how can I set a proxy server?
Command to use:
git config --global http.proxy http://proxyuser:[email protected]:8080
proxyuserto your proxy user
proxypwdto your proxy password
proxy.server.comto the URL of your proxy server
8080to the proxy port configured on your proxy server
Note that this works for both http and https repos.
If you decide at any time to reset this proxy and work without proxy:
Command to use:
git config --global --unset http.proxy
Finally, to check the currently set proxy:
git config --global --get http.proxy
Read more... Read less...
This worked for me, in windows XP behind a corporate firewall.
I didnt have to install any local proxy or any other software besides git v1.771 from http://code.google.com/p/msysgit/downloads/list?can=3
$ git config --global http.proxy http://proxyuser:[email protected]:8080 $ git config --system http.sslcainfo /bin/curl-ca-bundle.crt $ git remote add origin https://mygithubuser:[email protected]/repoUser/repoName.git $ git push origin master
proxyuser= the proxy user I was assigned by our IT dept, in my case it is the same windows user I use to log in to my PC, the Active Directory user
proxypwd= the password of my proxy user
proxy.server.com:8080 = the proxy name and port, I got it from Control Panel, Internet Options, Connections, Lan Settings button, Advanced button inside the Proxy Server section, use the servername and port on the first (http) row.
mygithubuser = the user I use to log in to github.com
mygithubpwd = the password for my github.com user
repoUser = the user owner of the repo
repoName = the name of the repo
Set a system variable named
http_proxy with the value of
That is the simplest solution. Respectively, use
https_proxy as daefu pointed out in the comments.
Setting gitproxy (as sleske mentions) is another option, but that requires a "command", which is not as straightforward as the above solution.
If the command line way of configuring your proxy server doesn't work, you can probably just edit .gitconfig (in the root of your profile, which may hide both in C:\Documents and Settings and on some network drive) and add this:
[http] proxy = http://username:[email protected]:8080
YMMV though, this only covers the first step of the command line configuration. You may have to edit the system git configuration too and I have no idea where they hid that.
As an alternative to using
git config --global http.proxy address:port, you can set the proxy on the command line:
git -c "http.proxy=address:port" clone https://...
The advantage is the proxy is not persistently set. Under Bash you might set an alias:
alias git-proxy='git -c "http.proxy=address:port"'
If you are using ubuntu, then do the following ...
Step 1 : Install corkscrew
$ sudo apt-get install corkscrew
Step 2 : Write a script named git-proxy.sh and add the following
#!/bin/sh exec corkscrew <name of proxy server> <port> $* # <name_of_proxy_server> and <port> are the ip address and port of the server # e.g. exec corkscrew 192.168.0.1 808 $*
Step 3 : Make the script executable
$ chmod +x git-proxy.sh
Step 4 : Set up the proxy command for GIT by setting the environment variable
$ export GIT_PROXY_COMMAND="/<path>/git-proxy.sh"
Now use the git commands,such as
git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git