error: index-pack died of signal fatal: index-pack failed
环境:
克隆Linux源码时发生错误
git clone https://github.com/torvalds/linux.git
error: index-pack died of signal fatal: index-pack failed
google云Compute Engine
Memory: 0.6GB内存
Linux版本: Debian GNU/Linux 9.5 (stretch)
错误原因
结合网上的博客、以及StackOverFlow的回答,问题原因应该是计算机内不足导致的
解决方法
1.--depth 1 只clone 最近一次的提交
#!/bin/bash
git config --global core.compression 0
git clone --depth 1 <repo_URI>
git fetch --unshallow
git pull --all
2.配置~/.gitconfig
gitconfig --global pack.threads 1
gitconfig --global pack.deltaCacheSize = 128m
git config --globalpack.windowMemory 1024m
这样一来,应该是可以减小资源的占用,但对于大的git还是无济于事。
3.配置交换空间
原理显而易见,通过提高系统内存,完成大git仓库的clone操作。