I went to my file directory, did

$ git init
$ git add

and then got

fatal: Out of memory? mmap failed: Cannot allocate memory

One folder is maybe 2GB big because it is full of images.. the rest are very small. What can be the problem here?

1 Answer 1


Your system don't have enough memory for to pack all the data in your repository into one file, which is git's default setting.

To work around this problem, set the pack.packSizeLimit configuration option to a value that is well within the available memory of your system.. You can set it with this command:

git config pack.packSizeLimit 1g

You can use the suffixes g for gigabytes, m for megabytes, or k for kilobytes. Calling git config without any switches will set the setting just for this particular repository. Use the --global switch to set it globally for your user account or --system for all user accounts on the machine (this option requires root access).

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.