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