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

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.

  • how to escape special characters in .gitconfig proxy authentication
  • How correctly set the remote on a local repository to my centralized repository on a server?
  • Windows git client over ssh for local repository?
  • omnibus or source - can't decide which one to use for gitllab backup/restore
  • Real-time git diff
  • git post-receive hook not running bundle install
  • git — How to schedule `git push` on linux?
  • Local Git as autosave
  • One Solution collect form web for “Why does git fail on push/fetch with “Too many open files””

    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

    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.

    Git Baby is a git and github fan, let's start git clone.