I wanted to implement a similar sort of feature with another Jekyll powered site I’m working on without having to use Github pages. Luckily for me after a bit of googling I found that Ryan Briones had already thought about it and had a working solution.
I recommend giving his article a read. I was able to follow his steps and do the same thing for my project. I did a slight cleanup of his post-receive script which I wanted to post here.
Put this script inside the source (non-local) repository repository that you are publishing to. When it receieves a push, it will execute the post-receive bash script and explode and compile the jekyll source.
Variable definitions (replace these with your own setup):
- GITSOURCE - the source git repository
- SOURCE - directory where the jekyll source is exploded to after a push
- PUBLIC - compiled jekyll files. Point your web server to this directory
Thanks again to Ryan Briones for this recipe. Happy Jekylling!