Git Init –Bare Error – fatal: Out of memory? mmap failed: No such device

I get that on initializing a bare repository, though there is about 1GB ram available in my remote machine. I’ve also taken a look at git add error : "fatal : malloc, out of memory", but it does not really help.

I don’t understand why this error is created, it seems quite weird. Why does this happen ?

  • How do I create a branch without cloning?
  • Git push - fatal: write error: Bad file descriptor
  • Syncing a fork in Bitbucket, Branches and are they synced?
  • Git reset files with typechange status
  • How can I find out what version of git I'm running?
  • Upgrading to Capistrano 3: prompt with 'translation missing: en.capistrano.questio' when running deploy:check
  • Giving Linux user git access but not shell access?
  • git push asks for username and password when pushed to shared private repository
  • SSH KEY Already Exists Bitbucket
  • Undefined symbol “locale_charset”
  • Github - using someone elses repository
  • Git is it possible to revert unstaged files after a checkout
  • 2 Solutions collect form web for “Git Init –Bare Error – fatal: Out of memory? mmap failed: No such device”

    Do you have a directory/file named “config” in your “bare” repo?

    See (mirror)

    EDIT: if so, you should almost certainly not be using git init --bare – bare is meant for empty “server” repositories that you intent to push to, not for initializing a new repo from a working tree.

    First, that’s a very bizarre error message.

    Second, what you need to do is this:

    1. In your source directory:

      git init

    2. Then, somewhere else:

      git clone –bare <your source directory> <name you want for your repository>.git


    git clone --bare my-source my-source.git

    You can then copy the resultant bare repository to your remote location and clone it.

    For completeness, a different way to do this is:

    1. Create an empty bare repository:

      mkdir my-source.git

      cd my-source.git

      git init –bare

    2. Go to your source directory and make it a git repo (non-bare):

      cd /path/to/my-source

      git init

    3. Add the bare repo as remote origin:

      git remote add origin /path/to/my-source.git

    4. And push the contents of your repo to the remote:

      git push –all

    If running git init (without --bare) inside your source directory gives this error, you have a different problem.

    Git Baby is a git and github fan, let's start git clone.