高速下载GitHubc仓库代码的两种方法(精选)

有没有喜欢编程的同志

下载GitHub上的代码

下载压缩包很慢

用git下载也很慢

毕竟GitHub是国外的

很慢也很正常

但是不是就没法儿了呢

其实不是

至少有两种方式可以告诉下载

今天就主要介绍其中最常用的两种

// 镜像 //

对,没错

用镜像就对了

在介绍之前

需要下载一个工具,git.exe

下载:

https://gitfor.org/

 

或者官网:

https://git-scm.com/downloads

 

安装好后,就可以在某个文件夹或者桌面克隆(下载)所需要的代码了

!!!重点:

使用github的镜像网站

原地址:

https://github.com/xxx.git

替换为:

https://github.com.cnpmjs.org/xxx.git

示例:

git clone https://github.com.cnpmjs.org/xxx.git

 

说白了,就在github.com后面加个cnpmjs.org即可

 

右键——>git bash here

 

比如,上期的power toys代码,想克隆到本地咋办

链接:

https://github.com.cnpmjs.org/microsoft/PowerToys.git

 

这里有两种方法:一个直接复制代码地址,克隆到本地

另外一种下载压缩包

 

这里克隆

在git 里输入:

git clone https://github.com/microsoft/PowerToys.git

 

这是一般下载,直接克隆下载的速度

 


 

这里现在使用镜像

 


 


 


 

这个方法很实用,简单方便:

原地址:https://github.com/xxx.git

替换为:https://github.com.cnpmjs.org/xxx.git

示例:git clone https://github.com.cnpmjs.org/xxx.git

// 码云 gitee//

网站:https://gitee.com/explore

 

需要注册一个账号,这个自己按照要求来,注册登录即可

注册时,可以绑定GitHub账号

如何下载GitHub上的代码呢

很简单,先从那里搬运过来,也可以说是拷贝

 


 

输入GitHub仓库地址

 

设置如下即可

 

导入一小会就好了

 

克隆下载即可

 

这里可以选择压缩包格式

 

输入验证

 

下载即可

 

几秒就好了

压缩包如下:

 

方法一下载如下:

 

这种方式对于下载大文件特别好用,通过搬运到本仓库,进行打包下载,虽然看着麻烦些,其实比较快。

个人觉得这两种方法可以解决所有GitHub仓库代码或者文件下载慢的问题。

总结:

方法一:

原地址:https://github.com/xxx.git

替换为:https://github.com.cnpmjs.org/xxx.git

示例:git clone https://github.com.cnpmjs.org/xxx.git

方法二:

搬运代码到码云gitee

下载压缩包

 

 

胜象大百科