Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

Edit:

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  

Edit2

selnaz:iOS-Tidinfo Lnaz$ ps xfu | wc -l
ps: illegal option -- f
usage: ps [-AaCcEefhjlMmrSTvwXx] [-O fmt | -o fmt] [-G gid[,gid...]]
      [-u]
      [-p pid[,pid...]] [-t tty[,tty...]] [-U user[,user...]]
   ps [-L]
   0
share|improve this question
    
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 Shahmehr 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

2 Answers 2

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
share|improve this answer

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!

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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