繁体   English   中英

远程:致命:在 memory 之外,realloc 在 git 上使用接收后挂钩推送失败

[英]remote: fatal: Out of memory, realloc failed on git push with post-receive hook

当我使用 1and1 执行git push remotename branchname到我的远程主机时,我收到以下错误消息:

Counting objects: 7, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (5/5), done.
Writing objects: 100% (7/7), 688 bytes | 0 bytes/s, done.
Total 7 (delta 2), reused 0 (delta 0)
remote: fatal: Out of memory, realloc failed

我在我的远程 git 存储库的挂钩中接收后设置了以下代码:

#!/bin/sh
git --work-tree=/absolute/path/to/remotedir --git-dir=/absolute/path/to/remotedir/live.git checkout -f

当我 SSH 到我的遥控器并free发布时,我看到有很多免费的 memory(不确定这是否与我的问题有关):

             total       used       free     shared    buffers     cached
Mem:      12330360   11796336     534024      32080      25248    8553496
-/+ buffers/cache:    3217592    9112768
Swap:       270332       3552     266780

我的遥控器正在使用:

Debian 3.14.73-2~ui80+4
git version 2.1.4

我的本地正在使用:

OS X 10.11.2
git version 2.4.9 (Apple Git-60)

真的不确定为什么会这样。 任何帮助表示赞赏!

编辑

当我在遥控器上运行ulimit -a时,我得到:

core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 1
file size               (blocks, -f) unlimited
pending signals                 (-i) 16382
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 512
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) 1800
max user processes              (-u) 42
virtual memory          (kbytes, -v) 786432
file locks                      (-x) unlimited

感谢@ЕлинЙ。 共享的 ! 但是我们在语法上遇到了一些问题,但也许适用于他的服务器。 对于 1and1,我们必须使用这个 git 配置来使远程仓库工作:

[core]
    packedGitWindowSize = 640m
    packedGitLimit = 640m
    preloadindex = false

[pack]
    windowMemory = 640m
    threads = 1

我以某种方式设法解决了这个问题。 至少,我有几个月没有得到它。 由于我做了很多试验和错误,阅读了许多不同的建议等,我不知道究竟是什么配置更改修复了它。

因此,我想分享我的 git 配置以帮助其他人作为参考:

core.preloadindex=false
core.packedgitwindowsize=640m
core.packedgitlimit=640m
pack.windowmemory=640m
pack.threads=1

根据 ulimit,您的托管服务器已将虚拟内存的每个进程限制设置为 768MB。 您的 post-hook 脚本正在被杀死,因为它的要求可能超出了限制。

您可以尝试更新您的 git 配置以适应您的环境。 这里有一些提示

https://github.com/hbons/SparkleShare/issues/519#issuecomment-3471638

在 1and1 主机上,在命令提示符下...

ulimit -a

报告了几件事......其中一个是:

open files (-n) 512

运行命令:

ulimit -Sn unlimited

它变成了:

open files (-n) 1024

然后git commit就可以了。 没有更多的错误。

我在签出分支时遇到此错误。 我不得不删除“ .git/hooks/post-checkout ”文件,它对我有用。 刚才提到如果其他人遇到同样的问题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM