通过代理使用 Git

原文链接http://cms-sw.github.io/tutorial-proxy.html

昨天Github竟然被墙了,导致 push 不上去。

通过 SSH 协议连接 Git 仓库

如果是这样连接远程的,就是通过 SSH 协议。

git@github.com:cms-sw/cmssw.git
ssh://git@github.com/cms-sw/cmssw.git

这样的话,要配置 SSH 本身的配置文件,设置ProxyCommand选项在 ~/.ssh/config。

Host github.com
    User                    git
    ProxyCommand            nc -x localhost:1080 %h %p

通过 HTTP 或者 HTTPS 协议连接

如果是这样的

http://github.com/cms-sw/cmssw.git   
https://github.com/cms-sw/cmssw.git

要这么配置

git config --global http.proxy socks5://localhost:1080

通过 Git 协议

如果是这样的

git://github.com/cms-sw/cmssw.git

就这么搞

git config --global core.gitproxy "git-proxy"
git config --global socks.proxy "localhost:1080"
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值