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.