My blog is generated by Jekyll and hosted on a Linode VPS. This is how I set up Git to allow me to instantly deploy updates.

My setup has gone through a few iterations over the years, as I changed technologies and tried to make it easier. I used to host it on GitHub pages but then I wanted some customisability over the server settings. Up until a few weeks ago, I was using a Travis to recognise when I pushed to the Git repo, which would trigger a build to push to my server. The main issue I had with this was Travis would sometimes take 5 minutes to see a new push. I wanted something a little faster.

Now my new setup is as follows: I added an extra Git remote (for push) to my local repo. So when I "git push", it pushes to both my GitHub repo and my server... nice!

git remote set-url --add --push origin ssh://user@host:port/folder/path

(I added it to origin but you could also create a new one. Just be sure to look up the documentation because I read some of the command behaviour is a little crazy.)

The advantage of this is I can instantly push, compile and release an update to my site instead of waiting for Travis. A disadvantage is I can no longer edit away from my laptop and deploy, but I'm working on this.

I have a Git "post-receive" hook set up to run when I push, which provides automatic compilation.


jekyll build --source $TMP_GIT_CLONE --destination $PUBLIC_WWW