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下来的仓库:
- Host 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
复制代码
|