7

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
3
  • 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? Commented Jun 26, 2012 at 20:23
  • @KennethHoste I add it above!
    – Elnaz
    Commented Jun 26, 2012 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. Commented Jun 26, 2012 at 22:37

3 Answers 3

7

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
1
  • I still get an error with something, but the operation succeeds, so, thank you!
    – Slbox
    Commented Sep 11, 2019 at 19:23
2

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!

0

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .