Shell script that sets up automatic sync for gh-pages
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Set up gh-pages

Sets up a repo after initial generation of Github pages and adds a hook for syncing after initial creation from GitHub.

Before running

These couple of shell scripts use curl, git, perl and shell commands. They should be in any basic Linux or Mac installation that is already using GitHub, but if it's not, sudo apt-get install curl perl and whatever else is not there.


  1. Generate GitHub pages though the web interface.
  2. git pull.
  3. Download and run and save it as .git/hooks/post-commit or do directly
curl -L  | bash

which will do the same for you.

Finally, edit your and commit to check the post-commit synchronization hook; push to publish the new version of the file.

If your project includes other files, you'll have to adapt the hook script.

I have tested it on all templates as of December 2014. It might not work for some new, or custom, templates, since everyone uses different elements to include the content. If so, you'll have to go and edit _layouts/index.html and insert by hand {{ "{{" }}content}} where you want your content to go. But please leave an issue in this repo and I'll try to fix it, with a sample of the index.html that generated it.

How does it work

It follows instructions in this StackOverflow question to set up gh-pages and then adds a script,, as a post-commit hook in the .git/hooks directory.