【注意】最后更新于 October 21, 2011，文中内容可能已过时，请谨慎使用。
Since someone is asking me to provide an English version about git proxy configuration in my former blog. Here it is. 1). Basically, I know two ways to use git behind a proxy.
- Set the http_proxy environment if git repository supports http connections.
find a proxy command to bypass the connection: connect.c
- Set up a wrapper
Here I’m using a http proxy offered by my school, which uses port 8080 The connect command also support socket proxy. Use -S host:port to indicate that.
- Update bashrc
The connect command reads proxy username and password from
CONNECT_PASSWORDevironment. The default username is current login user if no CONNECT_USER is set. Password will be requested interactively if CONNECT_PASSWORD is empty. GIT_PROXY_COMMAND indicates that git should use the command “proxy”(the wrapper we setup at step 2) as its proxy_command. This can also be set in .git/config.
Now, everything we need is done. Have a try:
文章作者 Chen, Zai-Chun
许可协议 CC BY-NC-ND 4.0