Git——git clone速度加快方法,并解决下载失败问题

使用国内镜像网站

目前已知Github国内镜像网站有github.com.cnpmjs.org。只需要在clone某个项目的时候将github.com替换为github.com.cnpmjs.org即可实现加速下载。如下例:
github.com:

git clone https://github.com/xmy0916/EuroTruckSelfDriver.git

龟速下载,实锤了。

在这里插入图片描述

github.com.cnpmjs.org:

git clone https://github.com.cnpmjs.org/xmy0916/EuroTruckSelfDriver.git

可以发现,使用国内镜像站速度飞快!

在这里插入图片描述

解决文件过大导致的下载失败问题

虽然成功下载飞快,但是又遇见了下载失败的问题!

问题

在这里插入图片描述

解决方法

方法一:

尝试过增加git缓冲区大小,扩大了8倍依然报错(因为博主下的文件在1.5G左右,所以可能过大所以失败,git clone较小一些文件的同学可以尝试使用该方法解决):

git config --global http.postBuffer 524288000
git config --list
方法二:(亲测成功)

浅层克隆,深度设置为1:

git clone http://github.com/target.git --depth 1  # target.git 为目标地址
cd target
git fetch --unshallow

成功截图:
在这里插入图片描述在这里插入图片描述

参考文章:

猜你喜欢

转载自blog.csdn.net/qq_45779334/article/details/109670820