when I want to do something: add , remove, pull , push in github, I just have this error in my terminal

Thanks in advance!

  selnaz:iOS-Tidinfo Lnaz$ git add .
  error: cannot fork() for status: Resource temporarily      unavailable
  fatal: Could not run git status --porcelain
  fatal: git status --porcelain failed
  fatal: git status --porcelain failed
  fatal: git status --porcelain failed
  fatal: git status --porcelain failed
  fatal: git status --porcelain failed
  fatal: git status --porcelain failed


selnaz:iOS-Tidinfo Lnaz$ ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
file size               (blocks, -f) unlimited
max locked memory       (kbytes, -l) unlimited
max memory size         (kbytes, -m) unlimited
open files                      (-n) 256
pipe size            (512 bytes, -p) 1
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 709
virtual memory          (kbytes, -v) unlimited  


selnaz:iOS-Tidinfo Lnaz$ ps xfu | wc -l
ps: illegal option -- f
usage: ps [-AaCcEefhjlMmrSTvwXx] [-O fmt | -o fmt] [-G gid[,gid...]]
      [-p pid[,pid...]] [-t tty[,tty...]] [-U user[,user...]]
   ps [-L]
  • Can you show us the output of ulimit -a in that same terminal? How many processes do you have running on that server? What does ps xfu | wc -l return? – Kenneth Hoste Jun 26 '12 at 20:23
  • @KennethHoste I add it above! – Elnaz Jun 26 '12 at 21:48
  • Try ps -xfu | wc -l instead, since the first one gave you an error. This command should count up the number of processes you have running. – Darth Android Jun 26 '12 at 22:37

The fork() system call should only fail (with that error) if there are too many processes running. See man 2 fork for details.

Rebooting should clear up the problem.

I'll speculate that maybe there are a lot of processes that haven't fully exited while debugging an iOS application.

Running the below line will show the three largest number of processes executing the same command (and how may processes are running those commands) to give an indication of what command is using up all the processes:

ps -efwww | awk '{print $8}' | sort | uniq -c | sort -n | tail -3
| improve this answer | |
  • I still get an error with something, but the operation succeeds, so, thank you! – Slbox Sep 11 '19 at 19:23

I had this issue just now. It was due to corruption in my git directory after copying it across disks. Git is a combination of small unix tools forking each other. Running git status was causing git to go spiralling downwards into an infinite recursion of processes, running into my system's process limits ("max user processes" in ulimit).

In my particular instance I had submodules, which involve hardlinking back the parent git repository, so removing the submodule and reinitializing fixed my issue.

You could also try doing a git clone of your repository somewhere else.

Another more drastic option would be delving into a copy of the .git directory and cleaning up all but the packs, objects and refs. You can preserve the working tree by copying it back over the top after the git repo is sane again.

Good luck!

| improve this answer | |

In my case, I was editing a txt file with Vi in a shell, while trying to push to Github in another shell. Exiting from Vi allowed the other shell to push without that error.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.