Git pull fails with bad pack header error

git pull fails with following error

remote: Counting objects: 146, done.
remote: fatal: unable to create thread: Resource temporarily unavailable
error: git upload-pack: git-pack-objects died with error.
fatal: git upload-pack: aborting due to possible repository corruption on the remote side.
remote: aborting due to possible repository corruption on the remote side.
fatal: protocol error: bad pack header

Any Ideas how to pull successfully ?

  • Why “git pull” command over https from github repository need “sudo” as prefix?
  • Use hg commands to operate git and hg simultaneously
  • Pushing a repository onto GitHub
  • Email notifications when issues are opened in GitHub
  • Can I rebase without first calling fetch from origin?
  • gitpython git authentication using user and password
  • EGit - “Replace With Commit…” doesn't work as excepted
  • How do I clone a git repo that has become too large?
  • Rails Migration Order and Git
  • How to avoid git rebase killing merge commits?
  • How do I find the Git commit where some code was removed?
  • how do I remove my git repo references from Team Explorer Connect
  • 2 Solutions collect form web for “Git pull fails with bad pack header error”

    The lines beginning with remote are output from git running on the remote system. The error:

    fatal: unable to create thread: Resource temporarily unavailable
    

    … strongly suggests that you’ve run out of memory on the server, which can happen if you have either:

    1. A repository with lots of large files, which can cause re-packing to take a lot of memory.
    2. Limited virtual memory – either in general, or just for that account due to the ulimit setting

    A suggestion here is to limit the amount of memory that packing may take by logging into the remote system (as the user that git runs as) and doing:

    git config --global pack.windowMemory "100m"
    git config --global pack.packSizeLimit "100m"
    git config --global pack.threads "1" 
    

    Update: this answer was an edit suggestion to Mark Longair’s answer, which has now updated his answer with the correct naming.

    In fact, pack.SizeLimit is incorrect, it’s pack.packSizeLimit.

    When I added this option, it worked for me 🙂

    I had to set it in both the local and the remote repositories.

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