If you have 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 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
Use HTTP proxy to download source code under various SCM tools
Often there is a need to download the source code using SCM, especially software developers. But our network environment often forces us to use proxies, either because of speed, or because of direct connection. And the source code is usually a fragmented thousands of tens of thousands of small files, unlike the general software is a single file, a download tool can be done.
1,cvs
CVS is cumbersome to use proxies and seems unable to use the HTTP proxy (please remind if I'm wrong), and the socks agent is pretty hard to find. Fortunately this dongdong has slowly become the yesterday yellow, we do not discuss it.
2,svn
SVN is more convenient, edit ~/.subversion/servers file can:
[Global]
http-proxy-host = IP or domain name > of < Agent
Http-proxy-port = < proxy port >
Http-proxy-username = < username, if necessary >
Http-proxy-password = < password, if necessary >
3,hg
HG is simpler because it uses the HTTP protocol, a command to resolve:
Export http_proxy=http://< username >:< password >@<ip>:< port >
4,git
Git can use two kinds of protocols, GIT protocol and HTTP, if the latter, then the way with HG, if it is git, more trouble, but also not unresolved:
First download a protocol conversion gadget: HTTP://WWW.MEADOWY.ORG/~GOTOH/SSH/CONNECT.C
Compiling: Gcc-o Connect connect.c
Place the generated connect in the executable path, such as/usr/bin
Then create a script that uses the proxy, assuming it is HTTP-PROXY-GW, and note that the executable attribute is included as follows:
#!/bin/sh
# Filename: ~/BIN/HTTP-PROXY-GW
# This script connects to a HTTP proxy using connect.c
Connect-h Http://yourproxyaddress:proxyport $@
Finally, configure Git:
git config--global core.gitproxy "HTTP-PROXY-GW for Xxx.yyy"
After the xxx.yyy is the domain name suffix, for example, download Linux source can be set to kernel.org
The proxy settings method for Git
In the laboratory to Git point dongdong down, toss the meeting, is basically available
Man Git-config can see that the agent that Git supports is dependent on another program
Here I am using a proxy applet written by someone else, see attachment
The configuration steps are as follows:
1. Gcc-o Connect connect.c
MV Connect ~/bin
2. Set up a wrapper
echo "/home/gigi/bin/connect-h proxy.bupt.edu.cn:8080 $@" >> ~/bin/proxy
chmod +x ~/bin/proxy
Here I am using the school's agent proxy.bupt.edu.cn, the port is 8080
Connect this applet also supports the socket proxy, use is Connect-s host:port
3. Echo "Export Connect_user=bergwolf" >> BASHRC
echo "Export Git_proxy_command=proxy" >> BASHRC
Connect programs from environment variables Connect_user and Connect_password
If the password is not set, the user name and password will be required to enter
Git_proxy_command is the agent that Git uses by default, or it can be set in. git/config
The GIT agent setup is complete and try it out:
[Gigi-ubuntu:bin] $git clone git://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git
Initialized empty Git repository in/home/gigi/bin/e2fsprogs/.git/
Enter Proxy authentication password for bergwolf@proxy.bupt.edu.cn:
Remote:counting objects:24006, done.
Remote:compressing objects:100% (4701/4701), done.
ceiving objects:1% (241/24006), 43.99 KiB | kib/s
Bravo:-)