首页 > 系统服务 > 详细

using git with proxy in ubuntu

时间:2015-09-22 16:49:29      阅读:2955      评论:0      收藏:0      [点我收藏+]

如果是 git clone http:// 或 git clone https:// 的话直接把代理服务器加到环境变量就可以了:

$ export http_proxy="http://username:password@squid.vpsee.com:3128/"
$ export https_proxy="http://username:password@squid.vpsee.com:3128/"

如果是 git clone git:// 的话麻烦一些(可能有的 git 源不提供 http/https 的方式),需要先安装 socat,安装路径在 usr/share/doc/socat 

然后创建一个叫做 gitproxy 的脚本并填上合适的服务器地址、端口号等,最后配置 git 使用 gitproxy 脚本: 

$ sudo apt-get install socat

$ sudo vi /usr/bin/gitproxy
#!/bin/bash

PROXY=squid.vpsee.com
PROXYPORT=3128
PROXYAUTH=username:password
exec socat STDIO PROXY:$PROXY:$1:$2,proxyport=$PROXYPORT,proxyauth=$PROXYAUTH

$ sudo  chmod +x /usr/share/doc/socat/gitproxy

$ git config --global core.gitproxy /usr/share/doc/socat/gitproxy


using git with proxy in ubuntu

原文:http://my.oschina.net/duanfangwei/blog/509615

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!