tags:

views:

48

answers:

2

Is it possible to create a Git repository that saves its objects into some database (SQLite, MongoDB, etc.) instead of on a filesystem?

It looks like I could probably store a full repository in MongoDB using something like GridFS.

Wondering if there is a way to make it so git push origin master reads from the database and acts just like the file system.

Is something remotely like that possible? Or must git be filesystem only?

+2  A: 

You'd have to rewrite a whole lot of code. Git was built to have a standard filesystem as its backing store (and was specifically built to be very fast on Linux's VFS subsystem).

The only truly practical way to accomplish something like this is if you wrote a FUSE filesystem that supported all the operations git requires, and used your database of choice as the back-end.

I'm not really sure why you'd want to do that or what you're looking to accomplish. There's really nothing to be gained in Git from the features of typical database, and a lot of performance to lose.

Nicholas Knight
Wanted to see if it was possible to create github repositories in a [Heroku](http://heroku.com/pricing) app, which requires everything be read-only and you can only upload apps via git. There's other options :)
viatropos
A: 

Git IS a database in itself.

You don't need to backup your data in a database. If you create a bare repository (git init --bare or git clone --bare), you won't have any file "checkout" on the system, and everything will be in the git "database".

By the way, if you really want to work with a read-only filesystem (different goal), the solution is not a database, but using an aufs filesystem overlay (or union mounts), to have every modification in another "writable" file system. Could be just in RAM if you want with a tmpfs.

Aissen