以前写过一篇关于tsocks的博客,讲解了一下tsocks的使用,这次在工作中呢,其他需要,所以又用英文写了一下。
我在网易博客中关于tsocks的博文在:
用英文写了一点tsocks用于git clone的方法如下:
How to clone external git repository using tsocks
What's the background?
To git clone something like git://external_network/temp.git in $my_company network will be blocked by our IT policy. This BKM will help you to resolve this issue using tsocks.
Note: The following steps on using tsocks is based on a RHEL6.x system and tocks-1.8-x. There should be some similar configuration with OSes or tsocks in different versions.
How to use tsocks to help your git-clone?
1. '''install tsocks: '''
• download this RPM for RHEL6.x attachment:tsocks-1.8-7.beta5.2.el6.rf.x86_64.rpm
• (or download source code from: http://sourceforge.net/projects/tsocks/files/tsocks/1.8%20beta%205/, and compile it.)
2. add/modify the config file '''/etc/tsocks.conf'''
1 2 3 4 |
server = proxy-shz.iii.com #your local proxy server: proxy-shz.iii.com, or proxy.jf.iii.com server_type = 5 #SOCKS version, use 5 as default server_port = 1080 #SOCKS proxy port, use 1080 as default local = 10.0.0.0/255.0.0.0 #internal network; will not use proxy when accessing this subnet |
Note: make sure the proxy server is in your local network. (Maybe it's the proxy server in your Intel site.)
3. use git clone with tsocks:
1 |
tsocks git clone git://git.kernel.org/pub/scm/virt/kvm/qemu-kvm.git qemu-kvm.git |
git clone a http repository
If your repository is using HTTP (something like "http://git.kernel.org/pub/scm/virt/kvm/qemu-kvm.git"), you only need to export 'http_proxy' environment variable before cloning.
for example:
1 2 |
export http_proxy=proxy.pd.iii.com:911 git clone http://git.kernel.org/pub/scm/virt/kvm/qemu-kvm.git qemu-kvm.git |