Configure Github Pages

Publish date: Apr 22, 2019
Tags: github pages configuration

To setup github-pages do one of the following:

publish from gh-pages branch

This is my preferred variant as it keeps the master branch clean.

setup branch

First step is to create an empty branch gh-repo. This is best done immediatly when creating the repo. This involves some modifying in the directory so have all important files from there somewhere backed up.

git checkout --orphan gh-pages

I had to do manual cleaning.

git rm -rf .
git add .
git commit -am "empty"

and publish to github:

git push --set-upstream origin gh-pages

Either way then you can switch back to master.

git checkout master

and add a worktree tracking gh-pages.

git worktree gh-pages

If the stars stand in your favour make page will write the files into the gh-pages subdirectory.

Then make publish will push the changes.

Github configuration is back here as the option to use gh-pages is only available after the branch has been created.

publish from docs folder

github configuration:

for building into docs you need to configure config.yaml to contain:

publishDir: gh-pages

The publish command is currently removed. In the Makefile you need to adjust the publish section to look like this:

publish: page
	git add docs/
	git commit -am "published"
	git push

This will commit everything in the docs folder with the message published.

Notes: