So I've been running this site on Jekyll for a while now hosted by GitHub pages. I like GitHub Pages for hosting however the way I was using it was to checkout my Jekyll source files and let GitHub Pages compile and render my site. This made some things easier, but I decided that I'd like to get a little crazy and start playing around with plugins. GitHub Pages out of the box does not support plugins because it would be a security issue. The way around this of course is to separate your source and site into different branches and allow GitHub Pages to just generate the static pages generated by my local copy of Jekyll.
This was in fact a little tricky for me because I'm not a git guru yet. Here's what I did.
-
Create a new folder structure locally with two clones of my website repo. One is
master
and the other issource
-
Rename my
master
branch tosource
viagit branch -m master source
-
Created the
source
remote branch viagit push origin source
-
Go into
master
folder (and branch) and delete all the files viagit rm -fr .
andgit commit
-
Go back into my
source
folder and update my_config.yml
file and specifydestination: ../master
and commit -
Rebuild site into master folder via
jekyll build
-
Go into
master
folder and add and commit all the generated files -
Push everything out to GitHub
Now the site source is kept in the source
branch and the generated site is in the master
branch. This is only for username.github.com
sites. If you wanted to do this for a project site you would do the same thing only use gh-pages
instead of master
.
Published June 29, 2013