搜索
 找回密码
 立即注册

经常从github拉取代码失败,专门为github设置个代理来解决

公子坚 2023-06-25 10:34 438

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

  1. git config --global http.https://github.com.proxy http://127.0.0.1:7890

  2. git config --global https.https://github.com.proxy http://127.0.0.1:7890
复制代码

3. 为ssh协议上的仓库设置代理即这种形式clone下来的仓库:

  1. git clone [email protected]:hybridgroup/gocv.git
复制代码
  • linux or mac:

  1. vim ~/.ssh/config
复制代码
  1. Host github.com
  2. ProxyCommand nc -X connect -x 127.0.0.1:7890 %h %p #-S为socks
  3. HostName %h
  4. Port 22
  5. User git
  6. IdentityFile  ~/.ssh/id_rsa
  7. IdentitiesOnly yes
复制代码



  • windows:
    编辑用户文件夹/.ssh/config

  1. Host github.com
  2. ProxyCommand connect -H 127.0.0.1:7890 %h %p   #-S为socks
  3. HostName %h
  4. Port 22
  5. User git
  6. IdentityFile  ~/.ssh/id_rsa
  7. IdentitiesOnly yes
复制代码





随机推荐

0 回复

游客
高级模式
作者最近主题
    返回顶部