Getting ikiwiki to work correctly with git seems
to be a bit of a black art. I thought I should probably document what
I've discovered in the hopes of saving somebody else the trouble of
figuring it out the hard way. This only covers getting the basic
setup working; in particular, I don't know how to set up the CGI (so
you can have a publically editable wiki, for instance), so any
information specific to doing that is not included.
Make sure you have the latest version of
git. Despite what its package dependencies say,ikiwikiin sid or backports depends on having a more recentgitthan was distributed withetch. If you don't do this, you'll get a confusing error message:
.fatal: Not a git repository: '.git'Make sure you are using two
gitrepositories:A
master
repository which you push directly into using
. This repository must be a bare repository (one without a working directory).git pushA
subordinate
repository in whichikiwikiactually runs. This repository must contain a working directory.
A mistake I often make is not creating the master repository as a bare repository. Thankfully, this is easy to fix. Just move the master repository out of the way, create a bare clone in its place, then remove the old master:
mv master master-tmp git clone --bare master-tmp master rm -fr master-tmp
The subordinate repository must be a clone of the master repository and not the other way around; i.e., it must have an
originbranch that points at the master. If it doesn't, then either updates won't be incorporated into the subordinate branch automatically (the post-update script tries to pull from the origin branch). If the subordinate repository does not have an origin branch at all, you'll get the message
.fatal: 'origin': unable to chdir or not a git archiveMake sure that the
option is enabled inrcsikiwiki.setupand set to
.gitMake sure the post-update wrapper is enabled:
wrappers => [ ... { wrapper => "/absolute/path/to/repository/hooks/post-update", }, ]If the path is not absolute, I seem to get errors from
ikiwiki.You have to run ikiwiki in the subordinate repository whenever you change the setup in order to create and/or update the post-update hook in the master repository.
Another tip I've found useful is to have two ikiwiki.setup files:
one for previewing on my own computer and a separate one (containing
all the git magic and a few changes to settings) for publishing on the
Web. I've adopted the convention of calling the published setup
ikiwiki-site.setup to avoid confusion.