14

I tried searching various other post but could not resolve my issue. Below is the error message that I get while doing git pull

error: cannot fork() for rev-list: Cannot allocate memory

error: Could not run git rev-list

error: cannot fork() for fetch-pack: Cannot allocate memory

I tried below command but unable to resolve it,

  1. git config --add core.bigFileThreshold 4m
  2. git gc --aggressive --prune=now This command failed to run unpack

Only the thing is that, there are many branches(100+). And the repo size is just 9MB (each file not greater than 100kb).

I thought of cloning the repo at some other location, but the clone failed with same error.

6
  • what is your OS ? what is your git version ?
    – LeGEC
    Mar 14, 2017 at 8:25
  • Ubuntu:14.04 and git version: 1.9.1 Mar 14, 2017 at 8:51
  • Do you still have this bug after a reboot ?
    – LeGEC
    Mar 14, 2017 at 10:02
  • 1
    Is the problem with git the only bug you have in your system ? or do you see bugs pop from other programs too ?
    – LeGEC
    Mar 14, 2017 at 10:03
  • Oh gr8. Other programs also had same issue. RAM usage was almost near to 90%-95%+. There was one process which was trying to utilize RAM memory, stopping this worked. Thanks for you help. Mar 14, 2017 at 10:12

2 Answers 2

16

This happens when your machine does not have enough memory. It can be because of one or more processes that are consuming too much memory. To solve this, you have to quit the memory consuming process.

Rebooting your OS may also help fix this issue. If rebooting didn't help, there is some memory expensive process that starts at system startup.

In Linux systems, please try the following:

  1. In terminal execute the command ps aux --sort -rss to list processes sorted by RAM usage.
  2. Note down the PID (process id) of first one or two processes in the list. (You can identify the process from column name COMMAND)
  3. Save any unsaved changes in that process by switching to its window.
  4. Use the kill command to kill that process. eg: kill 11234 (where 11234 is the PID)
  5. Now try git pull or whatever git command you were trying

In Windows, use Task manager to find and stop the memory consuming process or task.

In Mac OS you can use the built-in Activity Monitor app to find the culprit (Use the memory tab)

5
  • The only big memory consumer is X11, but when I kill that from a textual TTY, even then the system hangs. Dec 5, 2019 at 9:27
  • @MarkJeronimus I don't know much about X11. AFAIK, X11 is a windowing system and kill it all of a sudden will make your system hang. Please check if there is any graceful way to shut it down. Then try git pull again. Dec 7, 2019 at 14:17
  • Whenever it's shut down it auto-restarts and I couldn't find why or how. I went with removing xfce4 and reinstalling it later. Dec 9, 2019 at 10:15
  • I tried first to just restart the server (Gunicorn and Nginx) because I was using Django. It helped me. Your answers gave me that idea. Thanks.
    – elano7
    Apr 20, 2020 at 13:50
  • I had to use kill -9 <pid>
    – Gwen Au
    Sep 23, 2020 at 13:52
0

I face this issue because my server ram got full. You can check your server ram by using command line. ps aux --sort -rss It will show in percentages.enter image description here

Note: Am used ubuntu O/S.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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