using git with proxy in ubuntu
2015-09-22 14:54
423 查看
如果是 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
$ 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
相关文章推荐
- MySQL 临时目录
- RabbitMq 安装和 Hello World--.Net
- 处理程序“PageHandlerFactory-Integrated”在其模块列表中有一个错误模块“ManagedPipelineHandler”
- HDFs数据读取过程
- MFC写COM组件
- Spring常用annotation标签
- DWR3 搭建(转载)
- PAM 的应用开发和内部实现源码分析
- SpriteBuilder中物理对象能否被缩放
- SpriteBuilder中物理对象能否被缩放
- git bash 操作 从github上pull代码再从客户端push上去
- 友盟的必要处
- TCP/IP数据包结构详解
- VirtualBox里的Fedora,增加磁盘大小
- HiWork发布1.7.0新版本——可开启频道公开链接,增加HiWork客服功能及集成应用麦客
- Kth Smallest Element in a BST 寻找二叉排序树中第k小元素
- SpriteBuilder中物理对象能否被缩放
- PHP Framework - ThinkPHP
- shell脚本编程-计算方式
- 例子:动态生成下拉菜单,在对应的文本域显示选择内容