Getting git to work with 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?
Command to use:
git config --global http.proxy http://proxyuser:proxypwd@proxy.server.com:8080
proxyuser
to your proxy user proxypwd
to your proxy password proxy.server.com
to the URL of your proxy server 8080
to the proxy port configured on your proxy server 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
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:proxypwd@proxy.server.com:8080
$ git config --system http.sslcainfo /bin/curl-ca-bundle.crt
$ git remote add origin https://mygithubuser:mygithubpwd@github.com/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 ProxyServer:Port
. 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.
References: http://bardofschool.blogspot.com/2008/11/use-git-behind-proxy.html
链接地址: http://www.djcxy.com/p/17326.html上一篇: 应用程序服务器和Web服务器有什么区别?
下一篇: 让git使用代理服务器