I have been using Jekyll for a while now, but all this time I have been generating it on the server, That is, I had had a directory on the server holding the Jekyll files, in which I would run
jekyll build to generate the website. Not too streamlined.
Before hosting this weblog on Vultr, I had it on GitHub, and their Pages would do the publishing for me, right after a commit, which was great. Yesterday I decided to implement the same, but on my VPS. This is what I did:
- Created empty git repository (
git init --bare website.git).
- Cloned it.
- Added my Jekyll files.
- Added the following
#!/bin/bash -l GIT_REPOSITORY=/path/to/my/website.git TMP_GIT_CLONE=/tmp/git/website WWW_ROOT=/path/to/my/website git clone $GIT_REPOSITORY $TMP_GIT_CLONE jekyll build --source $TMP_GIT_CLONE --destination $WWW_ROOT rm -rf $TMP_GIT_CLONE exit
Now a few seconds right after committing, my website will show the changes. Being able to use Atom with
markdown-writer to compose entries, and use git to deploy them is a bliss.