Floating Octothorpe

Setting up a wiki with Gitit

It's often useful to have a place to dump personal notes. Wikis are ideal for this, however setting up a fully featured wiki like MediaWiki is often overkill. After spending a little bit of time looking at alternatives I stumbled across Gitit.

Gitit is relatively lightweight, can use multiple markup languages such as Markdown, and uses a Git repository to store page changes. This post is going to go over getting started with Gitit on Debian.

Installing Gitit

Gitit is part of the Debian repositories, therefore you can install it with apt-get:

sudo apt-get update
sudo apt-get install gitit libghc-filestore-data pandoc-data

Note: libghc-filestore-data and pandoc-data should both be package dependencies, but they are currently missing and need to be installed explicitly (see bug #865605).

Alternatively you can compile Gitit from source using stack:

git clone https://github.com/jgm/gitit
cd gitit
stack install

If everything goes well you should now be able to use the gitit command:

$ gitit --version
gitit version -plugins
Copyright (C) 2008 John MacFarlane
This is free software; see the source for copying conditions.  There is no
warranty, not even for merchantability or fitness for a particular purpose.

Creating a new wiki

Once Gitit is installed, running gitit without any options will create the initial files required for a wiki and startup a web server on port 5001:

$ mkdir ~/wiki
$ cd ~/wiki
$ gitit
Created repository in wikidata
Added Front Page.page to repository
Added Help.page to repository
Added Gitit User’s Guide.page to repository
Created static/css/custom.css
Created static/img/logo.png
Created templates/footer.st

The initial folder structure will be laid out as follows:

+-- gitit.log
+-- static
¦   +-- css
¦   ¦   +-- custom.css
¦   +-- img
¦       +-- logo.png
+-- templates
¦   +-- footer.st
+-- wikidata
    +-- Front Page.page
    +-- Gitit User’s Guide.page
    +-- Help.page

Note: wikidata is actually a Git repository, this makes it very easy to manage and revert page changes.

If everything is working correctly you should now be able to access the wiki on port 5001 in a web browser. The initial page should look similar to the following:

Screenshot of a default Gitit homepage

From here you can easily register an account and start editing pages. The Help and Gitit User's Guide pages should point you in the right direction if you run into any problems.

Starting Gitit with systemd

Unfortunately the gitit package doesn't come with a startup script. It is however fairly easy to create a systemd unit file similar to the following:

Description=Gitit wiki



Note: make sure the WorkingDirectory matches where you first run gitit.

Once you've create the file copy it to /etc/systemd/system/gitit.service, then enable and start the service with systemctl:

$ systemctl enable gitit.service
Created symlink /etc/systemd/system/multi-user.target.wants/gitit.service ? /etc/systemd/system/gitit.service.

$ systemctl start gitit.service

Gitit should now start automatically at boot. If you want to customise the unit file, the systemd.service man page is worth referring to for more info.