Git 推送“错误:索引包因信号 9 死亡”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7985124/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 12:13:24  来源:igfitidea点击:

Git push "error: index-pack died of signal 9"

gitgit-push

提问by Max Williams

I've seen a couple of similarquestionsto this, but haven't been able to solve my problem so am asking again.

我已经看到了几个与此类似的问题,但无法解决我的问题,所以我再次提问

I added a load of new files to an existing git-enabled project and am trying to push them up. When I do the push, it compresses them, then writes them, then when it gets to %100 it fails out with this error:

我向现有的 git-enabled 项目添加了大量新文件,并试图将它们推送。当我执行推送时,它会压缩它们,然后写入它们,然后当它达到 %100 时,它会失败并显示以下错误:

error: index-pack died of signal 9 332.28 MiB | 5712 KiB/s   
error: pack-objects died with strange error
error: failed to push some refs to     '<username>@<my repo location'

Things i have tried so far:

到目前为止我尝试过的事情:

  1. going to the repo and making sure everything is writable, like suggested here

  2. setting the binary -deltaoption on some filetypes in .gitattributes

  3. moving some of the folders out (and git committing the delete) with a view to adding them back individually later.

  1. 去 repo 并确保一切都是可写的,就像这里建议的那样

  2. binary -delta在 .gitattributes 中设置某些文件类型的选项

  3. 将一些文件夹移出(并 git 提交删除),以便稍后单独添加它们。

I'm kind of out of ideas... :/ Any suggestions? Grateful for any advice - max

我有点想法......:/有什么建议吗?感谢任何建议 - 最大

EDIT - I've since discovered that this is due to dreamhost killing the push due to excessive memory consumption (i did this by copying my app folder to the repo server on dreamhost and doing the push from there).

编辑 - 我后来发现这是由于 Dreamhost 由于过多的内存消耗而终止了推送(我通过将我的应用程序文件夹复制到 Dreamhost 上的 repo 服务器并从那里进行推送来做到这一点)。

I've foundsome pages, - that talk about a NO_MMAP=1option in git to help prevent this, but they talk about it in terms of configuring git when it's installed. Can i set this option in an existing git install? Is it part of the config for the git-inited app that's doing the push or is it part of the config for the repo?

找到了一些页面,- 讨论了NO_MMAP=1git 中的一个选项来帮助防止这种情况,但是他们在安装 git 时讨论了它的配置。我可以在现有的 git install 中设置这个选项吗?它是执行推送的 git-inited 应用程序的配置的一部分还是 repo 配置的一部分?

EDIT 2 - following the instructions on the page above, I downloaded and made my own local git binaries, with the NO_MMAP=1 option set.

编辑 2 - 按照上面页面上的说明,我下载并制作了自己的本地 git 二进制文件,并设置了 NO_MMAP=1 选项。

I made sure these were before the dreamhost-installed versions in my path, and "which git" shows my local version, so far so good. But, i get exactly the same problem.

我确保这些是在我的路径中安装了 Dreamhost 的版本之前,并且“which git”显示了我的本地版本,到目前为止一切顺利。但是,我遇到了完全相同的问题。

Do i need to do something with my repo to make the NO_MMAP option work, or is the problem something else do you think?

我需要对我的 repo 做些什么才能使 NO_MMAP 选项起作用,还是您认为还有其他问题?

采纳答案by Emil Sit

Git is somewhat memory intensive for certain operations, trading memory usage to get improved disk or network performance. (See for example some discussion on this other SO question.)

对于某些操作,Git 在某种程度上是内存密集型的,交易内存使用量以获得改进的磁盘或网络性能。(例如,参见关于这个其他 SO 问题的一些讨论。)

In this case, I think you and your colleagues are effectively doing a different cost trade-off: you are trading off using a professionally managed Git hosting service (such as GitHubor BitBucket) for either perceived financial savings or some other convenience (perhaps deployment?).

在这种情况下,我认为您和您的同事正在有效地进行不同的成本权衡:您正在使用专业管理的 Git 托管服务(例如GitHubBitBucket)进行权衡,以获得可感知的财务节省或其他一些便利(也许是部署) ?)。

My recommendation, if you are not comfortable following the kinds of recommendations on the wiki/blog-post that you've cited, is to move to GitHub or Bitbucket. (I think those posts offer technically accurate solutions, FWIW.) Bitbucket offers free unlimited private repositories so there's no real cost reason to use Dreamhost for your Git hosting.

我的建议是,如果您不习惯遵循您引用的 wiki/blog-post 上的各种建议,请移至 GitHub 或 Bitbucket。(我认为这些帖子提供了技术上准确的解决方案,FWIW。)Bitbucket 提供免费的无限制私有存储库,因此使用 Dreamhost 进行 Git 托管没有真正的成本原因。

If you need some sort of deployment solution to go along with the hosting, you can engineer something that takes pushes and automatically updates just the working directory to Dreamhost for hosting, without incurring the full cost of hosting a Git repository (and all of your history) on Dreamhost.

如果您需要某种部署解决方案来配合托管,您可以设计一些可以推送并自动将工作目录更新到 Dreamhost 以进行托管的东西,而不会产生托管 Git 存储库(以及您的所有历史记录)的全部成本) 在 Dreamhost 上。

回答by JGurtz

Sometimes this happens with an enterprise github as well due to load issues. I found a good way is to split the clone into two operations, which makes for lighter load on the server.

有时,由于负载问题,企业 github 也会发生这种情况。我发现一个好方法是将克隆拆分为两个操作,这样可以减轻服务器的负载。

First, do a shallow clone: git clone --depth 1 myRepo.git

首先,做一个浅克隆: git clone --depth 1 myRepo.git

Next, enter the clone, and get all the rest of the history to make a full clone: cd myRepo && git fetch --unshallow

接下来,输入克隆,并获取所有其余历史记录以制作完整克隆: cd myRepo && git fetch --unshallow

If you have an old version of git which does not support the --unshallow flag, then you can instead do something like git fetch --depth=1000000or some other suitably large number.

如果您有一个不支持 --unshallow 标志的旧版本 git,那么您可以改为执行类似git fetch --depth=1000000或其他适当大的数字。

Some more alternatives are discussed in this blog post: https://blogs.atlassian.com/2014/05/handle-big-repositories-git/

此博客文章中讨论了更多替代方案:https: //blogs.atlassian.com/2014/05/handle-big-repositories-git/

回答by El Mariachi

If you're using the Dreamhost server to keep bare repositories you can add and commit locally and then rsync your .git directory up to DH. After it finishes go into the server's [repository name].git/config and change core.bare from false to true.

如果您使用 Dreamhost 服务器来保留裸存储库,您可以在本地添加和提交,然后将您的 .git 目录同步到 DH。完成后进入服务器的 [repository name].git/config 并将 core.bare 从 false 更改为 true。

Not sure exactly what you'd do if you want work trees on the server, it hasn't come up for me.

如果您想在服务器上使用工作树,我不确定您会怎么做,我没有想到。

回答by Chris Edwards

I had this problem, but mine was caused by problems with the Capfile - capistrano had been updated and the changes were not reflected in the capfile.

我遇到了这个问题,但我的问题是由 Capfile 的问题引起的 - capistrano 已更新并且更改未反映在 capfile 中。

Updating the capfile to the latest standards fixed...

将 capfile 更新到最新的标准已修复...

回答by Cory McAboy

I ran into this error as well. The solution for me was the increase the memory capacity on my server. After doing so, the error went away.

我也遇到了这个错误。我的解决方案是增加服务器上的内存容量。这样做后,错误消失了。