配制过程分为以下几步:
1. 安装socat,在ubuntu下使用以下命令安装
sudo apt-get install socat
#!/bin/sh
# Use socat to proxy git through an HTTP CONNECT firewall.
# Useful if you are trying to clone git:// from inside a company.
# Requires that the proxy allows CONNECT to port 9418.
#
# Save this file as gitproxy somewhere in your path
# (e.g., ~/bin) and then run
# chmod +x git-proxy
# git config --global core.gitproxy git-proxy
#
#
# Configuration. Common proxy ports are 3128, 8123, 8000.
_proxy= 172.26.100.238
_proxyport=64000
exec socat STDIO PROXY:$_proxy:$1:$2,proxyport=$_proxyport
cp git-proxy /home/wilsonke/local/bin/
export PATH=$PATH:/home/wilsonke/local/bin
source ~/.bashrc
[push]
default = simple
[user]
name = wilsonke77
email = [email protected]
[core]
editor = emacs
gitproxy = git-proxy
[https]
proxy = http://wilson_ke:[email protected]:64000
[http]
proxy = http://wilson_ke:[email protected]:64000
gcc -o connect connect.c
将编译后的文件connect也拷贝到/home/wilsonke/local/bin下
6. 修改~/.ssh/config,加入以下行
ProxyCommand /home/wilsonke/local/bin/connect -H 172.26.100.238:64000 %h %p
Host github.com
User [email protected]
Port 443
Hostname ssh.github.com
git clone https://github.com/facebook/wangle
后记:很多开源项目同时可能还会用到wget来下载代码,同样,wget也要设置代理服务器
创建用户的~/.wgetrc文件中,添加如下内容:
http_proxy = http://172.26.100.238:64000/
ftp_proxy = http://172.26.100.238:64000/
--proxy-user=wilson_ke
--proxy-passwd=password
参考资料
http://blog.csdn.net/loveaborn/article/details/24575659