Git 克隆因内存不足错误而失败 - “致命:内存不足,malloc 失败(尝试分配 905574791 字节)/致命:索引包失败" [英] Git clone fails with out of memory error - "fatal: out of memory, malloc failed (tried to allocate 905574791 bytes) / fatal: index-pack failed"

查看:52
本文介绍了Git 克隆因内存不足错误而失败 - “致命:内存不足,malloc 失败(尝试分配 905574791 字节)/致命:索引包失败"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将大型 (1.4GB) Git 存储库克隆到具有 384MB RAM 的 32 位 Debian VM.我正在使用 Git 1.7.2.5,并使用 SSH 协议进行克隆 ('git clone user@host.com:/my/repo')

I'm attempting to clone a large (1.4GB) Git repository to a 32-bit Debian VM with 384MB of RAM. I'm using Git 1.7.2.5, and using the SSH protocol to clone ('git clone user@host.com:/my/repo')

克隆失败并显示以下消息:

The clone fails with this message:

remote: Counting objects: 18797, done.
remote: warning: subobtimal pack - out of memory
remote: Compressing objects: 100% (10363/10363), done.
fatal: out of memory, malloc failed (tried to allocate 905574791 bytes)
fatal: index-pack failed

我尝试减少 Git 用于在主机存储库端重新打包的内存量,并重新打包:

I've tried reducing the amount of memory Git uses to repack on the host repository end, and repacking:

git config pack.windowMemory 10m
git config pack.packSizeLimit 20m
git repack -a -d

我的问题如下:

  1. 这是一个客户端大小(克隆端)的问题,还是应该在我从中克隆的存储库中解决?
  2. 在这两种情况下,我能做些什么来让克隆成功吗?网上很多潜在的解决方案都涉及以下部分/全部,在这种情况下都不可接受:

  1. Is this a client-size (clone-side) problem or should it be resolved in the repo that I'm cloning from?
  2. In either case, is there anything I can do to make the clone succeed? A lot of the potential solutions online involve some/all of the following things, none of which are acceptable in this instance:

  • 大幅更改存储库的内容(即删除大文件)
  • 为执行克隆的 VM 提供更多 RAM
  • 为执行克隆的 VM 提供 64 位虚拟 CPU
  • 带外传输(例如使用 Rsync 或 SFTP 传输 .git 目录)

提前致谢.

推荐答案

git clone 不会查看您的 pack.packSizeLimit 设置,它无论如何都会将所有内容转移到一包 - 除非自从我上次查看后它发生了变化.

git clone will not look at your pack.packSizeLimit setting, it'll anyway transfer everything in a single pack - unless it changed since the last time I looked.

使用 SCP 或 Rsync 确实可以解决您的问题.删除无用"的大文件,然后重新打包您尝试克隆的存储库也会有所帮助.

Using SCP or Rsync might be a way to work around your issue indeed. Removing the "useless" large files, then repacking the repository you try to clone could also help.

为 VM 提供更多 RAM 也可能会有所帮助 - 我认为您不需要 64 位地址空间来分配 900MB...您还可以为其提供足够的 SWAP 空间来处理 900MB 包而不是增加内存.

Giving more RAM to the VM might also help - I don't think you'll need a 64-bits address space to allocate 900MB... You could also give it enough SWAP space to handle the 900MB package instead of increasing the RAM.

这篇关于Git 克隆因内存不足错误而失败 - “致命:内存不足,malloc 失败(尝试分配 905574791 字节)/致命:索引包失败"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆