![75c51584cc9e7012a8fa8bffe386e581.png](https://img-blog.csdnimg.cn/img_convert/75c51584cc9e7012a8fa8bffe386e581.png)
有没有喜欢编程的同志
下载GitHub上的代码
下载压缩包很慢
用git下载也很慢
毕竟GitHub是国外的
很慢也很正常
但是不是就没法儿了呢
其实不是
至少有两种方式可以告诉下载
今天就主要介绍其中最常用的两种
// 镜像 //
对,没错
用镜像就对了
在介绍之前
需要下载一个工具,git.exe
下载网站:
https://gitforwindows.org/
![c59294e92993ea1fe2a7a6fe3de4d610.png](https://img-blog.csdnimg.cn/img_convert/c59294e92993ea1fe2a7a6fe3de4d610.png)
或者官网:
https://git-scm.com/downloads
![095c97a3a9d2ab77930ed63e0811fdcf.png](https://img-blog.csdnimg.cn/img_convert/095c97a3a9d2ab77930ed63e0811fdcf.png)
安装好后,就可以在某个文件夹或者桌面克隆(下载)所需要的代码了
!!!重点:
使用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即可
![3eecea18f4232ffed63a471990ad39cb.png](https://img-blog.csdnimg.cn/img_convert/3eecea18f4232ffed63a471990ad39cb.png)
右键——>git bash here
![e6691a7597a924b86ed00dea9156caeb.png](https://img-blog.csdnimg.cn/img_convert/e6691a7597a924b86ed00dea9156caeb.png)
比如,上期的power toys代码,想克隆到本地咋办
链接:
https://github.com.cnpmjs.org/microsoft/PowerToys.git
![d9878202b9de89f57611b2226910b0d7.png](https://img-blog.csdnimg.cn/img_convert/d9878202b9de89f57611b2226910b0d7.png)
这里有两种方法:一个直接复制代码地址,克隆到本地
另外一种下载压缩包
![8ed309ce308c1721e8984503f80d337c.png](https://img-blog.csdnimg.cn/img_convert/8ed309ce308c1721e8984503f80d337c.png)
这里克隆
在git 里输入:
git clone https://github.com/microsoft/PowerToys.git
![fb667c1d79ff08878febf19999b42ea9.png](https://img-blog.csdnimg.cn/img_convert/fb667c1d79ff08878febf19999b42ea9.png)
这是一般下载,直接克隆下载的速度
![26920e409f670f9b91fd98b1c941c5d7.png](https://img-blog.csdnimg.cn/img_convert/26920e409f670f9b91fd98b1c941c5d7.png)
![96583dfd88187bb881da10ddf0407594.png](https://img-blog.csdnimg.cn/img_convert/96583dfd88187bb881da10ddf0407594.png)
这里现在使用镜像
![934dbb684802be3715efb648d4f05dd2.png](https://img-blog.csdnimg.cn/img_convert/934dbb684802be3715efb648d4f05dd2.png)
![1824139af642535ec0d3d3e5d1ce1f1b.png](https://img-blog.csdnimg.cn/img_convert/1824139af642535ec0d3d3e5d1ce1f1b.png)
![992b3ee426b83d1c5502a10995877fa0.png](https://img-blog.csdnimg.cn/img_convert/992b3ee426b83d1c5502a10995877fa0.png)
![fdd7535872aa86862b740cea471c38e0.png](https://img-blog.csdnimg.cn/img_convert/fdd7535872aa86862b740cea471c38e0.png)
这个方法很实用,简单方便:
原地址: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
![0b4c7392eb5ac13b0624e47dbd5d0088.png](https://img-blog.csdnimg.cn/img_convert/0b4c7392eb5ac13b0624e47dbd5d0088.png)
需要注册一个账号,这个自己按照要求来,注册登录即可
注册时,可以绑定GitHub账号
如何下载GitHub上的代码呢
很简单,先从那里搬运过来,也可以说是拷贝
![face92985426b2d41db9f4782bfd05ad.png](https://img-blog.csdnimg.cn/img_convert/face92985426b2d41db9f4782bfd05ad.png)
![973dfd86dff74ee87d01c1bfa95dfeb8.png](https://img-blog.csdnimg.cn/img_convert/973dfd86dff74ee87d01c1bfa95dfeb8.png)
输入GitHub仓库地址
![8eae7d7e91b7f7bf76b34ef0dbf8ef63.png](https://img-blog.csdnimg.cn/img_convert/8eae7d7e91b7f7bf76b34ef0dbf8ef63.png)
设置如下即可
![e366199e371cfaf2e8e653138fc26ba9.png](https://img-blog.csdnimg.cn/img_convert/e366199e371cfaf2e8e653138fc26ba9.png)
导入一小会就好了
![7feaef5e67db06e7ed2f572101117912.png](https://img-blog.csdnimg.cn/img_convert/7feaef5e67db06e7ed2f572101117912.png)
克隆下载即可
![c19d784e351ff295c71ca57f19886d19.png](https://img-blog.csdnimg.cn/img_convert/c19d784e351ff295c71ca57f19886d19.png)
这里可以选择压缩包格式
![0ffe2ec0a95eef0ff0169ed910bb5fab.png](https://img-blog.csdnimg.cn/img_convert/0ffe2ec0a95eef0ff0169ed910bb5fab.png)
输入验证
![7a0fc58ccc70ff1ad22d1ced70c56b50.png](https://img-blog.csdnimg.cn/img_convert/7a0fc58ccc70ff1ad22d1ced70c56b50.png)
下载即可
![02911d5beb7c3a52b74c79ca19502787.png](https://img-blog.csdnimg.cn/img_convert/02911d5beb7c3a52b74c79ca19502787.png)
几秒就好了
压缩包如下:
![f3637f52faae559205034246e559fa6a.png](https://img-blog.csdnimg.cn/img_convert/f3637f52faae559205034246e559fa6a.png)
方法一下载如下:
![093dbd5d1d6c756f3502e35877cc7367.png](https://img-blog.csdnimg.cn/img_convert/093dbd5d1d6c756f3502e35877cc7367.png)
这种方式对于下载大文件特别好用,通过搬运到本仓库,进行打包下载,虽然看着麻烦些,其实比较快。
个人觉得这两种方法可以解决所有GitHub仓库代码或者文件下载慢的问题。
总结:
方法一:
原地址:https://github.com/xxx.git
替换为:https://github.com.cnpmjs.org/xxx.git
示例:git clone https://github.com.cnpmjs.org/xxx.git
方法二:
搬运代码到码云gitee
下载压缩包
![3ca33135ff0f6ad39ca1f62a844be2ad.gif](https://img-blog.csdnimg.cn/img_convert/3ca33135ff0f6ad39ca1f62a844be2ad.gif)
喜欢点个赞+关注,后期精彩继续