Why does git fail on push/fetch with "Too many open files"

config, git, linux

Solution

There are two similar error messages:

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

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

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.

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

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.

Update from Hazok:

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.

Problem

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 ``` 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 error: cannot create pipe: Too many open files fatal: send-pack: unable to fork off sideband demultiplexer Could somebody answer exactly why this is happening? I have not made any recent changes to my git config and have verified that manually.

Original source

Related problems