This guide assumes you already have an existing Forestry Account, GitHub account, and a repository with a Jekyll or Hugo project. If you don’t have an existing project, check out our Quick start guide, which contains guides and resources for building your first static site.
To deploy a static site to GitHub pages using Forestry, you must first set up a new branch named
gh-pages on your repo, which you can do by going to your repository in GitHub and using the branch management dropdown.
Once your new branch is created, navigate to the Settings page of your site in Forestry, click the Hosting tab, and set the Connection option to GitHub Pages.
This will redirect you to GitHub, and prompt you to enter your login credentials if you are not already logged in.
Give Forestry access to your GitHub repositories by clicking “Authorize application”. You can also request access to any GitHub organizations you are a member of.
In order to host a site with GitHub Pages, you will need admin permissions for the repository. This is because Forestry needs to add a web hook to your repository in order to watch for changes.
Once authorized, you will be redirected back to Forestry.
Next, choose your repository, select the new
gh-pages branch, and then click Save Settings.
From here on, every time you save or publish a page Forestry will build your site and deploy to this branch.
Enable GitHub Pages
To have GitHub pages begin serving from your new branch, go to the
Settings page of your GitHub repository and scroll down to the
GitHub Pages section.
Then select the branch that contains your built static site and click on the Save button.
Your site should now be served at
Hugo CNAME file
With Hugo, ensure your CNAME file is in your
/static directory. Otherwise, Hugo will delete your CNAME file when building your site. More details here: Trouble shooting CNAME files
Caught a mistake or want to contribute to the docs? Edit this page on Github!