本文记录工作中遇到的clone
大仓库失败的解决过程,以下问题与解决方案均基于https
访问。
错误一
从web
端查看仓库大小,大约1.5G
左右,首先直接执行git clone
,报错如下:
1 | remote: Counting objects: 10994, done. |
增大postBuffer
在增大postBuffer
的同时,关闭ssl
认证:
1 | $ git config --global http.postBuffer 2048000000 # 设置为2G |
设置成功后,重新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 | $ cd git-2.7.4/ |
5.回到上一级目录,安装编译好的安装包:
1 | $ cd .. |
执行完成如上步骤后,重新clone
,发现依旧报错,请看错误二。
错误二
1 | remote: Counting objects: 10994, done. |
重新确认postBuffer
,配置确实生效了:
1 | $ cat ~/.gitconfig |
浅层clone
晕,实在搞不定了,采取极端方法,首先clone
一层:
1 | $ git clone --depth=1 http://xxx.git |
浅层clone
成功后,再完整拉取:
1 | $ git fetch --unshallow # 拉取完整当前分支 |
至此,终于成功地clone
了一个完整的仓库。