This guide assumes you already have an existing Forestry Account, GitHub account, and a repository with a 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 Deployment tab, and set the Connection option to GitHub Pages.
Click on “Click here to edit repo & branch” to connect your new gh-pages branch with Forestry.
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
Using a Custom Domain
If you want to use a custom domain with GitHub Pages, you will need to include a
CNAME file containing your custom domain. The
CNAME file should instead be added to your source files, in a location where it will be copied to the generated site. In the case of a Hugo site, this should be in your
static/ directory, while it can live in the root of your project if you’re using Jekyll.
If you manually add this file to your
gh-pages branch, it will be deleted the next time Forestry deploys your site.
Caught a mistake or want to contribute to the docs? Edit this page on Github!