Automatically deploying your blog with post-receive hooks

When deploying your Nikola blog with a post-receive hook keep in mind that you can't just use

git pull

Executing this command will result in the following error message.

remote fatal not a git repository '.'

This behavior is caused by the fact, that git does not use the PWD environment variable but GIT_DIR. Changing the directory does not change GIT_DIR, and therefore a git pull will fail. To get the behavior, you want to set the GIT_DIR environment variable like the following example shows.

cd /your/repo
GIT_DIR=.git git pull

Now you can continue to build your blog using Nikola.

Switching from blogofile to Nikola

A while ago I decided to write down my recipes an put them on a blog. The first question to answer was: Which platform should I use? I didn't like the idea of hosting my blog on someone else's server neither the idea of hosting some crapy php stuff (or any other stuff that is executed on my server). So I stumbled upon blogofile , a static site generator. After a few hours of setup and getting used to markdown my blog was online, ugly but up and running. Configured with git post-commit hooks and all that fancy stuff. Since then some time passed by and it seems that blogofile is no longer actively maintained and I decided to look out for a new platform to run my blog.

Read more…