Deploying Jekyll

27 November 2011

After spending some time setting up Jekyll, I realized I was serving my .git directory as well. Whoops. A quick google search yielded a pretty cool (but probably simple) trick that allows for handy deployment without serving embarassing commit comments.

In your hooks/ directory in your repo, create a file called post-receive containing the following:

#!/bin/sh
GIT_WORK_TREE=/path/to/public_html/ git checkout -f

This is a post-receive hook that will push to my public_html directory upon receiving a push from my local computer. I feel like I should’ve known this ages ago.