美文网首页
git为github设置代理的优雅方式

git为github设置代理的优雅方式

作者: Dakini_Wind | 来源:发表于2022-03-07 10:30 被阅读0次

1.仅clone代码

方案:在地址前加https://github.91chi.fun/
如: git clone https://github.com/hybridgroup/gocv.git
改为:git clone https://github.91chi.fun/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 git@github.com:hybridgroup/gocv.git

  • linux or mac
$ vim ~/.ssh/config
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

PS: 方式3参考了:Issue #1563 · Fndroid/clash_for_windows_pkg (github.com)

相关文章

  • git为github设置代理的优雅方式

    1.仅clone代码 方案:在地址前加https://github.91chi.fun/如: git clone ...

  • git设置代理

    访问github慢是一个通病,不过可以给git设置带来提速 1. 为git设置全局代理 2. 取消代理 3. 只对...

  • git常用命令

    Git常用命令 git中设置全局代理: 取消全局代理: 针对github进行单独设置: 查看当前用户的全局配置 显...

  • GIt设置代理

    GIt需要设置代理,才能正常访问github 等网站 设置如下(可复制): git config --global...

  • GIT 笔记

    git 访问github总是提示timeOut,可以通过设置代理解决。 设置方法: git config --gl...

  • idea、gitbash使用http代理设置

    idea设置http代理后,可以登录github但无法clone代码。 需要在Git bash中也设置代理 设置代...

  • git设置及取消代理

    git设置及取消代理//首先,设置默认代理,也可以理解为清除代理 //设置代理

  • 2019-12-17 wsl - git设置代理加速github

    wsl - git设置代理加速github拉去项目 1、使用命令 2、编辑文件 取消代理 git 标签的使用 gi...

  • GIT设置和取消http代理, 取消https代理

    为git设置http代理, https代理 可以使用 git config -l查看代理 取消http代理, 取消...

  • 设置git使用电脑vpn

    为git设置http代理, https代理git config --global https.proxy 'soc...

网友评论

      本文标题:git为github设置代理的优雅方式

      本文链接:https://www.haomeiwen.com/subject/gwggrrtx.html