经常从github拉取代码失败,专门为github设置个代理来解决
1.仅clone代码方案:在地址前加https://ghproxy.com/
如: git clone https://github.com/hybridgroup/gocv.git
改为:git clone https://ghproxy.com/https://github.com/hybridgroup/gocv.git
2. 为https/https协议上的仓库设置ps: 需要根据个人情况设置好端口号,如果是sock,则把https或http换为sock
git config --global http.https://github.com.proxy http://127.0.0.1:7890
git config --global https.https://github.com.proxy http://127.0.0.1:7890
3. 为ssh协议上的仓库设置代理即这种形式clone下来的仓库:
git clone [email protected]:hybridgroup/gocv.git
[*]linux or mac:
vim ~/.ssh/configHost github.com
ProxyCommand nc -X connect -x 127.0.0.1:7890 %h %p #-S为socks
HostName %h
Port 22
User git
IdentityFile~/.ssh/id_rsa
IdentitiesOnly yes
[*]windows:
编辑用户文件夹/.ssh/config
Host github.com
ProxyCommand connect -H 127.0.0.1:7890 %h %p #-S为socks
HostName %h
Port 22
User git
IdentityFile~/.ssh/id_rsa
IdentitiesOnly yes
页:
[1]