I know this has been asked a lot but I did not manage to get any solution to solve my problem.

My coworker assigned me on a new project. The application is hosted on test Debian server with git installed.

First I have created my branch :

git checkout -b mybranch

Then I have done small modifications to some files.

When I tried to push it to Github (using my github account)

git add myfile.php
git commit -m "my first commit"
git push origin mybranch

I get this error :

fatal: Out of memory, malloc failed

I don't understand what this mean. The total size of the files I tried to push is 156Ko. Moreover the total size of the project is only 10,9Mo.

I tried to reboot the server but the same happen.

When I run free on the server I get :

             total       used       free     shared    buffers     cached
Mem:        505312     239532     265780          0      51576      71580
-/+ buffers/cache:     116376     388936
Swap:            0          0          0

My coworkers never had this problem before, even on the same test server.

Can someone highlight me on the reason of this error and a possible workaround?
Thanks in advance.

  • Have you tried changing the settings in .git/config as suggested here? – 111--- May 13 '15 at 14:06
  • Yes but no luck... – hg8 May 13 '15 at 14:11
  • Can you try again with the -v flag, git push -v, and post the full error (redacting your repo info of course). – 111--- May 13 '15 at 14:24
  • The -v flag does not add anything to the error message... – hg8 May 13 '15 at 14:33
  • This looks like a bug somewhere. What version of Debian does the machine have? Can you reproduce the problem by cloning a local repository rather than one on github? If you can reproduce the problem without using any credentials or private information, run strace -o git.strace -tt git push origin mybranch (or whatever the failing git … command is) and post the resulting git.strace file (don't post the trace if it might contain something like a password). – Gilles 'SO- stop being evil' May 13 '15 at 22:20

Turn out it was indeed a ram problem. 268mo was not enough for git to function properly.

I solved the problem by adding 1Go of swap to the server:

$ sudo fallocate -l 1G /swapfile
$ sudo chmod 600 /swapfile
$ sudo mkswap /swapfile
$ sudo swapon /swapfile

I was getting same error as I was running jenkins in docker

I stop container and run git and this fixed the problem

Try to free some more space in RAM


I checked my RAM usage.

Enter command:

free -mh

I got very little left of RAM.

So I stopped my docker container and checked my RAM again.

Now it's back to normal.

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.