Dev Notes

Software Development Resources by David Egan.

Jekyll Push to gh-pages Branch


Sysadmin
David Egan

Make a sub-directory that contains a Jekyll site available at the gh-pages branch of a GitHub repo.

The site will then be available at http://USERNAME.github.io/REPONAME/

To begin with, set up an empty Repo. Don’t add a README.md when prompted.

Initialise git in the local project directory, and connect to the new repo.

cd project-directory
git init
git remote add origin https://github.com/USERNAME/REPONAME.git

Initial Subtree Commit

The local Jekyll site is built to the _site directory.

We need to tell git about the sub-directory and make an initial commit:

git add _site && git commit -m "Initial _site subtree commit"

Push to gh-pages

Send _site to the gh-pages branch on GitHub

git subtree push --prefix _site origin gh-pages

Push Ongoing Changes

Push all changes to the master branch:

git add -A

git commit -m "commit message"

Push changes to the gh-pages branch:

git subtree push --prefix _site origin gh-pages


comments powered by Disqus