Ubuntu Linux下通过代理(proxy)使用git上github.com
来源:互联网 发布:人月神话 知乎 编辑:程序博客网 时间:2024/05/07 05:00
github.com,作为程序员的代码仓库,我们经常会用到。但有时候我们不能直接通过网络链接它,只能通过代理。
这里我有一台代理服务器,起初我以为在终端设置了代理环境就行了,其设置为在你的~/.bashrc里增加以下几行:
export http_proxy="http://proxy-server:3128/"export https_proxy="http://proxy-server:3128/"export ftp_proxy="http://proxy-server:3128/"
设置好以后,使用以下命令使其启动
source ~/.bashrc
然后测试wget是没有问题的,如下:
但使用git clone就不行
git clone git@github.com:aborn/ulitcs.git通过这两篇文章知道了原因:在windows上通过代理访问github.com 和 Using git over proxy
配制过程分为以下几步:
1. 安装socat,在ubuntu下使用以下命令安装
sudo apt-get install socat
2. 编辑一个脚本文件,名字为git-proxy ,内容如下
#!/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=proxy-server_proxyport=3128exec socat STDIO PROXY:$_proxy:$1:$2,proxyport=$_proxyport
3. 将git-proxy放到一个目录下,如我将它放到/home/lisp/local/bin,并将该目录加入到PATH
cp git-proxy /home/lisp/local/bin/将该目录加入到PATH,加入以下内容到~/.bashrc,然后souce ~/.bashrc
export PATH=$PATH:/home/lisp/local/bin
source ~/.bashrc
gitproxy = git-proxy我.gitconfig文件内容如下:
[push]default = simple[user]name = abornemail = loveaborn@foxmail.com[core]editor = emacsgitproxy = git-proxy[https]proxy = http://proxy-server:3128[http]proxy = http://proxy-server:3128
5. 下载转换协议文件connect.c,下载地址点击
只要下载connect.c文件即可,然后编译
gcc -o connect connect.c
将编译后的文件connect也拷贝到/home/lisp/local/bin下
6. 修改~/.ssh/config,加入以下行
ProxyCommand /home/lisp/local/bin/connect -H proxy-server:3128 %h %p
我的~/.ssh/config文件内容如下:
ProxyCommand /home/lisp/local/bin/connect -H proxy-server:3128 %h %pHost github.comUser loveaborn@foxmail.comPort 443Hostname ssh.github.com
注意这里的connect文件目录与第5步放置的目录一致。
以上步骤完成后,就行了,如下截图:
git clone git@github.com:aborn/ulitcs.git
git push
注意:
1. 上面的proxy-server根据你的代理,设置为替换为你的代理服务器的ip地址或者域名
2. 上面的connect.c 文件、编译好的connect文件和git-proxy文件,也可以从这里下载connect.tar.gz 和 git-proxy
3. 我的操作系统为Ubuntu 14.04LTS
0 0
- Ubuntu Linux下通过代理(proxy)使用git上github.com
- Ubuntu Linux下通过代理(proxy)使用git上github.com
- Linux下git通过proxy访问github
- 使用git 从 github上通过代理下载项目
- git 通过 https.proxy 下载github上的项目
- ubuntu下使用git, github
- Ubuntu linux github & git使用
- Windows下使用Git和GitHub.com
- linux 下终端下 代理设置 git proxy
- linux通过http代理使用github
- Ubuntu下Git以及Github使用
- Ubuntu下Git以及Github使用
- Ubuntu下Git以及Github使用
- Ubuntu下Git以及Github使用
- ubuntu下git使用ssh连接github
- Git使用:Linux(Ubuntu 14.04 x64)下安装Git并配置连接GitHub
- 通过代理使用 Git
- Ubuntu下Git的安装和使用,linux下更新GitHub源码
- QA Manager Required Skills
- 【故障处理】ORA-12162: TNS:net service name is incorrectly specified
- android ANR
- windows安装pip
- 在彩色图像上进行Mean Shift迭代搜索目标 ,rgb三维加权直方图 + 巴氏系数 + Mean Shift迭代
- Ubuntu Linux下通过代理(proxy)使用git上github.com
- 在重写了对象的equals方法后,还需要重写hashCode方法吗?
- HDU 1502 DP+大数
- Quartz 框架 教程(中文版)2.2.x 之第二课 Quartz API,Jobs和Triggers简介
- 快播倒下了,网盘站起来
- ubuntu 14.04 64bit安装32bit的arm交叉工具链
- 《算法概论》第七周作业——背包问题
- hostapd实现WIFI 热点(AP)
- 计算器