How do I get git to use a proxy server?
I need to check out code from a git server, it shows "Request timed out" every time. How do I get around this?
Alternatively, how can I set a proxy server?
How do I get git to use a proxy server?
I need to check out code from a git server, it shows "Request timed out" every time. How do I get around this?
Alternatively, how can I set a proxy server?
I have tried all the above answers and nothing worked for me, as there was a proxy password encoding issues.
This command worked:
Do not enter the password in your command. It will dynamically ask for when you try to connect to any git repo.
Command to use:
proxyuser
to your proxy userproxypwd
to your proxy passwordproxy.server.com
to the URL of your proxy server8080
to the proxy port configured on your proxy serverIf you decide at any time to reset this proxy and work without proxy:
Command to use:
Finally, to check the currently set proxy:
If you have tsocks or proxychains installed and configured, you can
or
to make it shorter, I created a symbol link
/usr/bin/p
forproxychains
, so I can use it like thisand I can use it to proxy any command,
by the way, proxychains is not updated for a long time, you may wanna try proxychians-ng
Setting git proxy on terminal
if
Set it globally once
if you want to set proxy for only one git project (there may be some situations where you may not want to use same proxy or any proxy at all for some git connections)
if you want to display current proxy settings
if you want to remove proxy globally
if you want to remove proxy for only one git root
For windows users: if
git config
orset http_proxy=
doesn't work, this answer may help:replace the
git://
protocol of the git repository withhttp://
. Note, you'll have to set thehttp_proxy
first, anyways.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:
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.