Q:

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 ?

A:

First, that's a very bizarre error message.
Second, what you need to do is this:

In your source directory:
git init
Then, somewhere else:
git clone --bare <your source directory> <name you want for your repository>.git

e.g.,
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:

Create an empty bare repository:
mkdir my-source.git
cd my-source.git
git init --bare
Go to your source directory and make it a git repo (non-bare):
cd /path/to/my-source
git init
Add the bare repo as remote origin:
git remote add origin /path/to/my-source.git
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.

A:

Do you have a directory/file named "config" in your "bare" repo?
See http://www.bitchx.com/log/git-f/git-f-20-Mar-2010/git-f-20-Mar-2010-03.php (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.

