git fetch:无法分配内存

时间:2013-12-18 08:15:09

标签: git

  1. 首先我做:git submodule update --init
  2.     Cloning into '_aaa'...
        Checking connectivity... done.
        Submodule path '_aaa': checked out '87311dd0bb0ac9b77cd9bbac0a15671858f0cf17'
    
    1. 然后:git fetch --recurse-submodules
    2.     Fetching submodule _base
          Fetching submodule _aaa
          Auto packing the repository for optimum performance. You may also
          run "git gc" manually. See "git help gc" for more information.
          Counting objects: 21678, done.
          Compressing objects: 100% (20602/20602), done.
          Writing objects: 100% (21678/21678), done.
          Total 21678 (delta 8973), reused 0 (delta 0)
          Removing duplicate objects: 100% (256/256), done.
          fatal: Out of memory? mmap failed: Cannot allocate memory
          fatal: Out of memory? mmap failed: Cannot allocate memory
          error: failed to run prune
      

      上次更新大约1GB,但没有超过40MB的文件。

      我将服务器上的内存量从512M增加到1024M,但问题仍然存在。我也尝试过使用git gc,window,compress等不同的游戏而没有任何结果。

1 个答案:

答案 0 :(得分:3)

错误本身起源于git的sha1对象处理代码,但很难说是什么,而不知道errno返回的mmap是什么。

您可以在strace下运行命令并在此处发布mmap失败的行吗?

编辑:尝试git config --add core.bigFileThreshold 4m(或者甚至更少的数字)。

core.bigFileThreshold

    Files larger than this size are stored deflated, without attempting delta compression. Storing large files without delta compression avoids excessive memory usage, at the slight expense of increased disk usage.

    Default is 512 MiB on all platforms. This should be reasonable for most projects as source code and other text files can still be delta compressed, but larger binary media files won’t be.

    Common unit suffixes of k, m, or g are supported.

https://www.kernel.org/pub/software/scm/git/docs/git-config.html