找回密码
 立即注册
查看: 153|回复: 0

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

[复制链接]

216

主题

0

回帖

216

积分

中级会员

积分
216
发表于 2023-6-25 10:14:02 | 显示全部楼层 |阅读模式
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 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 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
  1. 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
复制代码
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|翻墙党

GMT+8, 2026-9-26 17:37 , Processed in 0.084465 second(s), 23 queries .

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表