赞
踩
git config --global https.proxy http://127.0.0.1:7890
git config --global https.proxy https://127.0.0.1:7890
取消的命令:
git config --global --unset http.proxy
git config --global --unset https.proxy
相信这种方法大多人都使用过,当使用github的时候,需要开代理,但是使用国内的git仓库或者自建的git仓库的时候,代理反而成了累赘。这里可能就需要用到单仓库加速了。
有时候我们对 github 的仓库进行 clone 的时候,会发现很慢,甚至是龟速,很不够效率。好在有一个简单且快捷的方法来倍速提升clone 效率。
我们通过检索 git 的帮助文档发现有这样的描述
If you just want to use proxy on a specified repository, don’t need on other repositories. The preferable way is the -c, —config <key=value> option when you git clone a repository. e.g.
git clone https://github.com/flutter/flutter.git --config "http.proxy=192.168.0.105:7890"
上面的例子
--config "http.proxy=192.168.0.105:7890"
设置代理192.168.0.105:7890
是代理的地址,需要自己搭建或者可用的,我这里是使用clash的局域网本地代理。上面的配置好,再次执行,基本上可以得到百倍的提效。
部分转载自技术小黑屋:https://droidyue.com/blog/2022/10/26/speed-up-git-clone-via-proxy/
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。