Git Web frontend with stagit(1)

stagit(1) reads Git repositories and generates static pages for them with a predefined CSS stylesheet (I said stylesheet twice!), a website logo and a favicon.

Required:

Install stagit(1):

        $ git clone git://git.codemadness.org/stagit
        $ cd stagit
        # doas make install clean
        

I like to have everything stagit(1)-related inside /var/www/htdocs/git.mydomain.com along with the actual repositories, but you can choose any other directory.

Store the stylesheet, logo and favicon inside. You'll find the stylesheet inside the stagit(1) repository you cloned earlier; it's called style.css. For the logo and favicon, just make your own, but make sure they are in PNG format and have the same names as below.

        # cp logo.png favicon.png style.css /var/www/htdocs/git.mydomain.com
        

You can edit the stylesheet to your likings, but if you're afraid that you'll mess things up, play around with the colors only.

Here I created a repository named repo in /var/www/htdocs/git.mydomain.com/repo.git. I will now make a directory to store the files that stagit(1) will produce. I like to give it the same name as the repository but without the .git extension:

        # mkdir /var/www/htdocs/git.mydomain.com/repo
        $ cd /var/www/htdocs/git.mydomain.com/repo
        

Create symlinks for the stylesheet, logo and favicon inside the directory you just created:

        # ln -s ../style.css ../logo.png ../favicon.png .
        

Run stagit(1) and generate the static page for your repository. This has to be done inside the directory you just created since stagit(1) stores the files in the working directory. Make sure that you give it the .git directory (i.e the actual repository):

        # stagit ../repo.git
        

Go to the top-level Git directory and generate an index.html file which is your Git server's homepage where all repositories will be listed. Again, you give it the actual repositories:

        $ cd /var/www/htdocs/git.mydomain.com
        # stagit-index repo.git > index.html
        

Fire up a browser and go to git.mydomain.com and you should see everything. Success!