对 git 使用的 http://, https:// 和 git:// 协议代理
1. http://
git config --global http.proxy http://192.168.1.1:1080
代理协议是socks5
git config --global http.proxy socks5://192.168.1.1:1080
2.https://
git config --global https.proxy socks5://192.168.1.1:1080
代理协议是socks5
git config --global https.proxy socks5://192.168.1.1:1080
3.git://
(1) 输入一下内容到 ~/.ssh/config 文件(如果没有, 手动创建)
Host github github.com
ProxyCommand /home/yourname/tools/connect_git %h %p
(2)在上述路径下创建文件connect_git, 输入一下内容
cat > home/yourname/tools/connect_git <<'EOF'
#!/bin/sh
export SOCKS5_PASSWD=""
connect-proxy -S 192.168.136.1:1080 $@
EOF
(3)配置git代理
在core section 添加: gitproxy = connect_git
全部配置文件如下
[alias]
st = status
co = checkout
ci = commit
br = branch
rs = reset
rb = rebase
[user]
name = dzt
email = allen.zt.d@gmail.com
[core]
editor = vim
gitproxy = connect_git
[color]
ui = true
[http]
proxy = socks5://127.0.0.1:2080
[https]
proxy = socks5://127.0.0.1:2080
(4) 使用git clone git://xxx@github.com 测试
更多推荐
所有评论(0)