如何让 Git 使用 HTTP 代理服务器?

如何让 Git 使用 HTTP 代理服务器?,第1张

如果是 git clone http:// 或 git clone https:// 的话直接把代理服务器加到环境变量就可以了。

如果是 git clone git:// 的话麻烦一些(可能有的 git 源不提供 http/https 的方式),需要先安装

socat,然后创建一个叫做 gitproxy 的脚本并填上合适的服务器地址、端口号等,最后配置 git 使

用 gitproxy 脚本。

方案:在地址前加 https://github.91chi.fun/

如: git clone https://github.com/hybridgroup/gocv.git

改为: git clone https://github.91chi.fun/https://github.com/hybridgroup/gocv.git

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

即这种形式clone下来的仓库:

git clone git@github.com:hybridgroup/gocv.git

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


欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/bake/7890810.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-04-11
下一篇2023-04-11

发表评论

登录后才能评论

评论列表(0条)

    保存