Keeping /etc in git and other version control systems has been talked about and attempted by lots of people. I tried it with CVS, but that was a joke, with svn, but it sucked, now with git I actually have something I think I'm happy enough about to use.

There's already a tool to do this, but I was not really impressed with isisetup. After considerable pain to find the source code (download links that resolve to 192.168. addresses are niice), I found that it was pretty old and had lots of weird hardcoded things like server names, and it wants to be a git porcelin with its own set of commands for manipulating the /etc repository. I don't want that, I just want a simple setup procedure that lets me use regular git commands to manage the repo.

So instead I followed the lead of these blogs combined with David Härdeman's metastore for solving the metadata storage problem. I also hacked in a solution to the empty directory storage problem, and a few other issues with trying to use git for this thing that it was not really designed for.

I'm very happy with the way it works, you just run "etckeeper init" and then can commit etc as usual with the file permissions etc included in the commits. Clone the same repo to elsewhere and again "etckeeper init" is all you need to restore those permissions (be sure to not clone the repo to a world readable directory, as there is a window when files would be readable).

Automatically committing changes at the end of apt runs is also a handy feature. :-)

etckeeper is currently only available from git. ftp-master is down so I can't upload packages, but both it and metastore can be built from git easily enough:

git clone git://git.hardeman.nu/metastore.git; cd metastore; dpkg-buildpackage
git clone git://git.joeyh.name/etckeeper; cd etckeeper; dpkg-buildpackage

(Update: Now uploaded to unstable.)

discussion