Deploy a Hugo website to gh-pages branch on GitHub

Mon, Mar 26, 2018 02:00 CEST

Follow the instructions on Hugo’s website.

Initialize the gh-pages branch

git checkout --orphan gh-pages
git reset --hard
git commit --allow-empty -m "Initializing gh-pages branch"
git push origin gh-pages
git checkout master

Check out existing gh-pages branch into /gh-pages

rm -rf gh-pages
git worktree add -B gh-pages gh-pages origin/gh-pages