Tracking Config Files with Git, Cogito and Gitweb

I recently took a look at the gitweb interface on kernel.org and it really attracted me. I thought it would be nice to manage the config files in my home directory with git and make them available on the net via gitweb.

If you are new to git/cogito I would strongly recommend to investigate a few minutes and work through the README.

In Debian you can install git and cogito with apt-get install cogito. And then proceed as explained in the README.

Per default cg-init adds all files in the current directory to the repository which is actually not that useful for monitoring config files in a home directory where only dot files are of interest. However, newer version of cogito provide a few command line options for us -I is especially handy because it doesn’t perform an initial commit at all.

So we are able to set up a git repository without any files by running

cg-init -I

Afterwards you can continue by adding further files as you like, if an error occurs during the initial commit you should add the -C option.

cg-add .bash_profile

Now that the files are added we can do an initial commit.

cg-commit -m"Initial commit"

For further help with cogito or git read the corresponding manual pages.

So now lets install gitweb.

apt-get install gitweb

Gitweb expects the git repositories in /var/cache/git but this can easily be changed by editing /etc/gitweb.conf. However, I prefer to symlink the content from my home directory to the default gitweb project directory as shown below.

ln -s /home/marc/.git /var/cache/git/config-files.git

That’s it you can know view your repository on http://localhost/cgi-bin/gitweb.cgi (assuming a default web server configuration).

Marc