

Git仓库过大导致clone失败的解决方法
source link: https://answerywj.com/2019/09/09/git-clone-extra-large-project/
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.

Git仓库过大导致clone失败的解决方法
本文记录工作中遇到的clone
大仓库失败的解决过程,以下问题与解决方案均基于https
访问。
从web
端查看仓库大小,大约1.5G
左右,首先直接执行git clone
,报错如下:
1
2
3
4
5
6
remote: Counting objects: 10994, done.
remote: Compressing objects: 100% (3085/3085), done.
error: RPC failed; curl 56 GnuTLS recv error (-110): The TLS connection was non-properly terminated.
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
增大postBuffer
在增大postBuffer
的同时,关闭ssl
认证:
1
2
$ git config --global http.postBuffer 2048000000 # 设置为2G
$ git config --global http.sslVerify false # 关闭sslVerify
设置成功后,重新clone
,错误依旧。
使用openssl替换gunssl
1.安装相关依赖环境:
1
$ sudo apt-get install build-essential fakeroot dpkg-dev libcurl4-openssl-dev
2.获取git源码:
1
$ sudo apt-get source git
若出现如下错误:
1
E: You must put some 'source' URIs in your sources.list
则需要将设置->Software & Updates
->Ubuntu Software
->Source code
勾选:
若出现如下错误:
1
couldn't be accessed by user '_apt'. - pkgAcquire::Run (13: Permission denied) [duplicate]
则需要更改权限:
1
sudo chown _apt /var/lib/update-notifier/package-data-downloads/partial/
3.安装git
的依赖
1
$ sudo apt-get build-dep git
4.进入git
目录,重新编译:
1
2
3
4
$ cd git-2.7.4/
$ vim ./debian/control # 将libcurl4-gnutls-dev修改为libcurl4-openssl-dev
$ vim ./debian/rules # 整行删除TEST=test
$ sudo dpkg-buildpackage -rfakeroot -b -uc -us -j4 # 编译
5.回到上一级目录,安装编译好的安装包:
1
2
$ cd ..
$ sudo dpkg -i git_2.7.4-0ubuntuxxx_amd64.deb # 安装包名字可能有所不同
执行完成如上步骤后,重新clone
,发现依旧报错,请看错误二。
1
2
3
4
5
6
remote: Counting objects: 10994, done.
remote: Compressing objects: 100% (3085/3085), done.
error: RPC failed; curl 18 transfer closed with outstanding read data remaining
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
重新确认postBuffer
,配置确实生效了:
1
2
3
4
5
$ cat ~/.gitconfig
[http]
sslVerify = false
postBuffer = 2048000000
浅层clone
晕,实在搞不定了,采取极端方法,首先clone
一层:
1
$ git clone --depth=1 http://xxx.git
浅层clone
成功后,再完整拉取:
1
2
3
$ git fetch --unshallow # 拉取完整当前分支
$ git remote set-branches origin '*' # 追踪所有远程分支
$ git fetch -v # 拉取所有远程分支
至此,终于成功地clone
了一个完整的仓库。
Reference
About me
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
本作品采用知识共享署名-相同方式共享 4.0 国际许可协议进行许可。
Recommend
-
16
Github使用新的token认证机制导致push失败问题解决Github push推东西的时候突然报错了,一查发现是换了认证方式的原因,之前输入密码push,现在得改用token了,但是网上重置仓库密码啥的试了push都还是失败...
-
12
Win10更新Win11失败错误代码0x0怎么回事 错误代码0x0解决方法 2021-10-1510:10:55...
-
7
KaliLinux安装失败的解决方法 2014-03-18操作系统 不知道什么原因,安装kalilinux的时候总...
-
14
node-sass 安装失败解决方法 ####使用cnpm npm install -g cnpm ####使用淘宝镜像 SASS_BINARY_SITE=https://npm.taobao.org/mirrors/node-sa...
-
8
专注移动互联网,专注Unity3D游戏开发 ...
-
16
解决 gitlab 因 Prometheus 磁盘占用过大的问题 作者:
-
6
电源模块是什么?电源模块噪音过大的原因及解决办法! 精选 原创 稳控科技 2022-0...
-
8
Python3.10.4激活venv环境失败解决方法 精选 原创 环境 python -m venv venv
-
4
注册ChatGPT失败的几个问题和解决方法专门为跨境电商提供跨境资讯,海外卖家经验分享,独立站的玩法,希望你们喜欢我提供的内容。
-
7
用logrotate解决catalinna.out过大的问题 2023-12-28 1 分钟阅读 用logrotate解决catalinna.out过大的问题 我们的tomcat的catalina.out基本运行一段时间后会出现文件过大的...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK