Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git pull cannot allocate memory

Tags:

git

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.

like image 728
Amar Kamthe Avatar asked Mar 14 '17 07:03

Amar Kamthe


1 Answers

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)

like image 195
Mohammed Shareef C Avatar answered Sep 22 '22 17:09

Mohammed Shareef C