Integrate Pelican Site and Github Page With Post Commit Hook

written on Aug 16, 2014 by

On Pelican's doc Tips section, they have a trick to help you automatically push your output generated by Pelican to Github Page using post-commit hook. As a newbie, I didnt know how to make post-commit script executable until I found Amy Hanlon's Post. So this is how you do it step by step:

Go to .git/hooks/ in your local username.github.io repo and create a file named post-commit:

$ vim .git/hooks/post-commit

Put following lines in post-commit:

#!/bin/bash
pelican content -o output -s pelicanonf.py && ghp-import output && git push git@github.com:username/username.github.io.git gh-pages:master

Lastly, make post-commit executable by running following command:

$ chmod a=r+w+x .git/hooks/post-commit
comments powered by Disqus
 

Categories