git clone http://<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="76001d17031a36050217051e581f1802581a1f180c581c031b1f195815191b" rel="noreferrer noopener nofollow">[email protected]</a>/git/BUILD/build-tools.git
cloning into 'build-tools'...
fatal: Out of memory, malloc failed (tried to allocate 2000000000 bytes)
fatal: write error: Invalid argument
我知道这个问题之前曾被问过,但在这种情况下,解决方法是增加 RAM。现在奇怪的是,存储库有 2.2GB 大,而我有 5.5GB 可用 RAM 和 50GB 可用硬盘。为什么会出现这个错误呢?有什么想法吗?
最佳答案
有一个名为 packSizeLimit 的配置属性。在我的 Git 安装中,默认设置为 2G。也许您的安装也是如此。您可以通过执行以下操作来检查
git config -l
在命令行上查看是否有名为 pack.packSizeLimit 的条目。如果是这样,请尝试增加该值。
关于即使有 5.6GB 空闲内存和 50GB 硬盘,git clone 也会出现内存不足的情况,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12147773/