git push fatal: unable to create thread: Resource temporarily unavailable
I'm new to git. I'm want to push a large commit to a remote server but the problem is when I use
git push origin master
it return the error
Counting objects: 5009, done.
Delta compression using up to 16 threads.
fatal: unable to create thread: Resource temporarily unavailable
error: pack-objects died with strange error
So is there anyway I can set the max thread use for Delta Compression.
Thanks for help,
Yuan Chen
Solution 1:
The error: "fatal: unable to create thread: Resource temporarily unavailable" strongly suggests you've run out of memory on the server, which can happen if you have a repository with lots of large files, which can cause re-packing to take a lot of memory, or limited virtual memory - either in general, or just for that account due to the ulimit setting.
Anyways, here's the commands you can run to limit the amount of memory that packing may take by logging into the remote system (as the user that git runs as) and typing these commands:
git config --global pack.windowMemory "100m"
git config --global pack.packSizeLimit "100m"
git config --global pack.threads "1"
Hope this works.
Solution 2:
In shared hosting we have limited cpu resources mostly 1 cpu so multi-threading does not work very well there. This error is due to limited cpu resource actually.
Just this one git setting is enough to resolve this.
git config --global pack.threads "1"
This is limiting git to create only one thread.
Solution 3:
I've also stumbled upon this error. To make it simpler, this error occurs because you want to copy a 100mb file into a hdd with free space of 50mb (or less). To fix this, SSH into the server and run the following commands:
git config --global pack.windowMemory "100m"
git config --global pack.packSizeLimit "100m"