14

利用github.com.cnpmjs.org快速下载GitHub仓库

 3 years ago
source link: https://note.qidong.name/2020/12/github-proxy/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

利用github.com.cnpmjs.org快速下载GitHub仓库

2020-12-28 16:56:49 +08  字数:406  标签: GitHub

自从某个中国互联网的标志性事件后,GitHub的访问和下载也因为技术问题而异常缓慢。 这里介绍一个git clone的提速方案,加快GitHub仓库的下载。

URL替换

执行以下配置命令:

git config --global url."https://github.com.cnpmjs.org/".insteadOf "https://github.com/"

或直接修改~/.gitconfig文件,添加以下内容:

[url "https://github.com.cnpmjs.org/"]
	insteadOf = https://github.com/

以上配置,仅对https协议生效,对SSH协议不生效。 在URL替换后,仓库里的配置直接时基于https://github.com.cnpmjs.org/的。 如果需要换回来,或者换成SSH协议,则需要使用:

git remote set-url origin ...
git remote add github ...

由于GitHub增量下载,还是勉强能接受的,因此在clone后把URL换回来,或者多remote管理,也是可行方案。

结论

github.com.cnpmjs.org是一个未在官方文档公开的一个GitHub代理。 从域名上看,应该时属于cnpmjs.org的一部分。 能用多久,不好说。

另一个方案是使用网络代理,这个方向就不展开了。



本作品采用 知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议 进行许可,详见本站版权声明

本站没有任何支持评论功能的计划。 如果你对本站的设计、内容、观点有什么意见,欢迎来信指正。


作者:匿蟒 邮箱:[email protected] 备案:闽ICP备15022549号


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK