为什么git在使用“太多打开的文件"进行推送/提取时失败? [英] Why does git fail on push/fetch with "Too many open files"

查看:67
本文介绍了为什么git在使用“太多打开的文件"进行推送/提取时失败?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在收到以下消息时遇到Git问题:

I'm encountering an issue with Git where I'm receiving the following message:

> git fetch
error: cannot create pipe for ssh: Too many open files
fatal: unable to fork

系统管理员增加了我的文件限制,但它没有纠正问题.此外,使用vi创建新文件没有问题.

The System Administrators have increased my file limit, but it has not corrected the issue. Additionally, I don't have an issue with creating new files with vi.

当尝试推送新分支时,我收到类似消息:

When trying to push a new branch, I get a similar message:

git push origin test_this_broken_git错误:无法创建管道:打开的文件过多致命:send-pack:无法分叉边带解复用器

git push origin test_this_broken_git error: cannot create pipe: Too many open files fatal: send-pack: unable to fork off sideband demultiplexer

有人能确切回答为什么会这样吗?我最近尚未对git config进行任何更改,并已手动进行了验证.

Could somebody answer exactly why this is happening? I have not made any recent changes to my git config and have verified that manually.

推荐答案

有两个类似的错误消息:

There are two similar error messages:


EMFILE: Too many open files
ENFILE: Too many open files in system

您似乎正在获取 EMFILE ,这意味着单个进程的文件数已超过.因此,检查 vi 是否可以打开文件是不相关的- vi 将使用其自己的单独文件表.使用以下方法检查您的限额:

It looks like you're getting EMFILE, which means that the number of files for an individual process is being exceeded. So, checking whether vi can open files is irrelevant—vi will use its own, separate file table. Check your limits with:


$ ulimit -n
1024

因此,在我的系统上,单个进程中最多可以打开1024个文件.您无需询问系统管理员(请不要使用首字母缩写词SA,因为它太不透明;如果必须缩写,请使用"sysadmin")来提高限制.

So on my system, there is a limit of 1024 open files in a single process. You shouldn't need to ask your system administrator (please don't use the acronym SA, it's too opaque; if you must abbreviate, use "sysadmin") to raise the limit.

您可能希望通过在 strace 下运行Git来检查Git打开的文件.

You may wish to check which files Git opens by running Git under strace.

这可能是Git或库中的错误,或者可能是您使用的是旧版本的东西,或者可能是更奇怪的东西.首先尝试 strace 来查看它打开了哪些文件,并检查Git是否关闭了这些文件.

This could be a bug in Git or in a library, or it could be you're using an old version of something, or it could be something more bizarre. Try strace first to see which files it opens, and check whether Git closes those files.

从Hazok更新:

使用上述建议后,事实证明该错误是由过多的散落物体引起的.松散的对象太多,因为 git gc 的运行频率不够高.

After using the above recommendations, it turns out the error was caused by too many loose objects. There were too many loose objects because git gc wasn't being run often enough.

这篇关于为什么git在使用“太多打开的文件"进行推送/提取时失败?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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