Using git to install dokuwiki

Since some months now I use Subversion to update my WordPress installation. A simple “svn switch” to the new tag does the trick, and your WordPress installation is up to date! Since my Dokuwiki installation are getting older and older, I decided doing that with Dokuwiki as well. The source code of Dokuwiki is hosted in a Git repository over at Github. I found nowhere a short instruction how to do that with git, so I thought I write one.

First of all, you need git to install git (always strange to install such software on a server, but who cares :-))

sudo aptitude install git-core

When you already have a Dokuwiki installation, you have to convert it to a git repository. Because git clone doesn’t allow using a non-empty directory, we have to work around this limitation. Warning: Using this method you will loose any changes made to Dokuwiki specific files. Configuration and data should be in their own files so you won’t loose such data.

git clone -b stable -n http://github.com/splitbrain/dokuwiki.git
mv dokuwiki/.git/ .
rmdir dokuwiki
git checkout -f

When you are going to install a new installation, use this command

git clone -b stable http://github.com/splitbrain/dokuwiki.git wiki

For security reasons its recommend to disallow the .git directory for HTTP requests by adding these lines to the .git/.htaccess file. You should also remove install.php.

rm install.php
vi .git/.htaccess
order allow,deny
deny from all

To update your installation, just use the command git pull, which will pull the latest commits from the original Github repository.

git pull

Leave a Comment