Encountered this issue with this Git: 

remote: Counting objects: 1702, 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

Reason: 

  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

Solution: 

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

Finally, running Git pull command.