发布时间:2014-09-05 17:40:52作者:知识屋
github.com,作为程序员的代码仓库,我们经常会用到。但有时候我们不能直接通过网络链接它,只能通过代理。
这里我有一台代理服务器,起初我以为在终端设置了代理环境就行了,其设置为在你的~/.bashrc里增加以下几行:
export%20http_proxy="http://proxy-server:3128/"export%20https_proxy="http://proxy-server:3128/"export%20ftp_proxy="http://proxy-server:3128/"
source%20~/.bashrc
但使用git%20clone就不行
%20git%20clone%20git@github.com:aborn/ulitcs.git%20通过这两篇文章知道了原因:在windows上通过代理访问github.com 和 Using%20git%20over%20proxy
配制过程分为以下几步:
1.%20安装socat,在ubuntu下使用以下命令安装
%20sudo%20apt-get%20install%20socat%20
#!/bin/sh#%20Use%20socat%20to%20proxy%20git%20through%20an%20HTTP%20CONNECT%20firewall.#%20Useful%20if%20you%20are%20trying%20to%20clone%20git://%20from%20inside%20a%20company.#%20Requires%20that%20the%20proxy%20allows%20CONNECT%20to%20port%209418.##%20Save%20this%20file%20as%20gitproxy%20somewhere%20in%20your%20path#%20(e.g.,%20~/bin)%20and%20then%20run#%20chmod%20+x%20git-proxy#%20git%20config%20--global%20core.gitproxy%20git-proxy###%20Configuration.%20Common%20proxy%20ports%20are%203128,%208123,%208000._proxy=proxy-server_proxyport=3128exec%20socat%20STDIO%20PROXY:$_proxy:$1:$2,proxyport=$_proxyport
cp%20git-proxy%20/home/lisp/local/bin/将该目录加入到PATH,加入以下内容到~/.bashrc,然后souce%20~/.bashrc
export%20PATH=$PATH:/home/lisp/local/bin
source%20~/.bashrc
4.%20修改~/.gitconfig,加入以下行和代理
gitproxy%20=%20git-proxy我.gitconfig文件内容如下:
[push] default%20=%20simple[user] name%20=%20aborn email%20=%20loveaborn@foxmail.com[core] editor%20=%20emacs gitproxy%20=%20git-proxy[https] proxy%20=%20http://proxy-server:3128[http] proxy%20=%20http://proxy-server:3128
5.%20下载转换协议文件connect.c,下载地址点击
只要下载connect.c文件即可,然后编译
gcc%20-o%20connect%20connect.c
6.%20修改~/.ssh/config,加入以下行
%20ProxyCommand%20/home/lisp/local/bin/connect%20-H%20proxy-server:3128%20%h%20%p%20
ProxyCommand%20/home/lisp/local/bin/connect%20-H%20proxy-server:3128%20%h%20%pHost%20github.comUser%20loveaborn@foxmail.comPort%20443Hostname%20ssh.github.com
以上步骤完成后,就行了,如下截图:
git%20clone%20git@github.com:aborn/ulitcs.git%20%20%20
git%20push
linux一键安装web环境全攻略 在linux系统中怎么一键安装web环境方法
Linux网络基本网络配置方法介绍 如何配置Linux系统的网络方法
Linux下DNS服务器搭建详解 Linux下搭建DNS服务器和配置文件
对Linux进行详细的性能监控的方法 Linux 系统性能监控命令详解
linux系统root密码忘了怎么办 linux忘记root密码后找回密码的方法
Linux基本命令有哪些 Linux系统常用操作命令有哪些
Linux必学的网络操作命令 linux网络操作相关命令汇总
linux系统从入侵到提权的详细过程 linux入侵提权服务器方法技巧
linux系统怎么用命令切换用户登录 Linux切换用户的命令是什么
在linux中添加普通新用户登录 如何在Linux中添加一个新的用户
2012-07-10
CentOS 6.3安装(详细图解教程)
Linux怎么查看网卡驱动?Linux下查看网卡的驱动程序
centos修改主机名命令
Ubuntu或UbuntuKyKin14.04Unity桌面风格与Gnome桌面风格的切换
FEDORA 17中设置TIGERVNC远程访问
StartOS 5.0相关介绍,新型的Linux系统!
解决vSphere Client登录linux版vCenter失败
LINUX最新提权 Exploits Linux Kernel <= 2.6.37
nginx在网站中的7层转发功能