For a small static or Jekyll site, GitHub Pages can give you staging and production without a separate hosting bill. You still have to draw the lines carefully. You need a source repository, a review site, a public site, a build workflow, and a plain rule for promoting changes.
This site, jasonchance.com, is a Jekyll site published through GitHub Pages. The pattern here comes from working with a real static site workflow.
A deployment workflow should make the safe action easy and the risky action deliberate.
The setup below uses GitHub Pages for both destinations and GitHub Actions to move generated output between repositories. It works well for documentation sites, civic projects, small organization sites, and other static sites that don’t need a server runtime.
Start With One Source Repository
Keep the Jekyll source in one repository. Use main as the staging and review branch, and production as the public release branch.
Spell out what each branch is for:
main: The full site source used for development, review, and staging deployments.production: The source state approved for the public site.
Developers can work locally, run bundle exec jekyll serve, and push to main when they want outside feedback. A pull request from main to production is the promotion step.
That’s cleaner than keeping two separate copies of the source. Templates, configuration, content, and dependency changes all live in one place, and the production branch records which reviewed version of the source is public.
Use Separate Pages Repositories for the Built Sites
GitHub Pages publishes one site from a repository. A simple setup looks like this:
example-site: the source repository containing the Jekyll project.example-staging: the deployment repository forstaging.example.com.example-production: the deployment repository forexample.com.
The source repository holds the code people review. The deployment repositories hold generated output. Keeping them apart means a staging build can’t go public just because it built successfully.
GitHub Pages supports custom workflows for static site generators, and Jekyll is supported as a static site generator [1] [2].
Make the Workflow Branch-Aware
The source repository can use one workflow with two branch paths.
On a push to main, the workflow should:
- Check out the source.
- Install the required Ruby and Jekyll dependencies.
- Build the site into
_site. - Publish
_siteto the deployment branch forexample-staging.
On a push to production, the workflow should run the same build and publish the output to the deployment branch for example-production.
So main updates staging, and a merged promotion pull request updates production. GitHub’s Pages workflow documentation supports separate build and deployment jobs, which helps when you want to treat the build artifact and the publishing target as separate steps [1].
Promote With a Pull Request
Don’t promote by copying generated files from one repository to another by hand. Open a pull request from main to production, review the source changes, merge it, and let the production branch kick off its deployment.
That gives every release a visible approval point. The pull request can hold content review, link checks, accessibility checks, and a record of who approved the public change.
Use a Narrow Cross-Repository Credential
When the source workflow publishes to a separate deployment repository, it needs credentials that can write there. Store the credential as an Actions secret, and never put it in the workflow file or the generated site [3].
Use a fine-grained personal access token or a GitHub App installation that can only reach the deployment repository it needs, with only the permissions it needs. A token that can write to every repository in an account is far too broad for a job that only publishes static files [4].
If the workflow publishes staging from main, the staging credential shouldn’t also be the production credential. With separate access, a mistake in a branch condition does less damage.
Protect the Production Environment
Create a production environment and let only the production branch deploy to it. A job that references an environment has to meet that environment’s protection rules before it can use environment secrets or keep going [5].
That gives you a second line of defense. The workflow condition says which branch should run the production job. The environment policy says which branch is allowed to use the production deployment target.
Configure the Domain and HTTPS
GitHub Pages gives each deployment a default github.io address. A custom domain such as example.com or staging.example.com still needs DNS records and repository settings. GitHub documents the DNS and HTTPS steps, including domain verification [6].
DNS is part of the deployment. A workflow can publish files without a hitch while the public domain still points somewhere else, has a stale record, or is waiting on a certificate. Test the default Pages address and the custom domain separately.
Understand the Free Plan Limits
This approach can save you a separate hosting bill. GitHub Pages still isn’t private hosting, and it isn’t an application server.
On GitHub Free, Pages works from public repositories. Treat both the repository source and the published site as public. GitHub Pages has no built-in password protection for an ordinary public site. GitHub Pro includes Pages for private repositories, but private Pages publishing requires an organization on GitHub Enterprise Cloud [7].
There are structural limits too:
- one user or organization Pages site per account,
- one project Pages site per repository,
- a published site limit of 1 GB,
- a 10-minute deployment timeout,
- and soft bandwidth and build limits.
Custom workflows don’t lift the storage, deployment, or bandwidth limits, though the standard 10-builds-per-hour limit doesn’t apply when you build and publish with a custom Actions workflow [8].
GitHub Pro can be good value when a small team needs Pages connected to private source repositories or plans to run several simple public project sites. It won’t turn a Pages site into a password-protected private application, and each site still needs its own repository and domain setup.
Know What Pages Cannot Run
GitHub Pages serves static output. It can host Jekyll-generated HTML, CSS, JavaScript, images, feeds, and other build artifacts. It can’t run server-side Ruby or PHP, hold a database connection, process private form submissions, or keep application sessions.
If your site needs any of that, keep the static front end on Pages and put the server-side piece on a service built to run it. Don’t use a static deployment repository as a place to hide credentials or private data [9].
The Simpler Two-Repository Alternative
You can also keep separate source repositories:
example-staging-sourcefor review work,example-production-sourcefor the public site.
That’s easier to understand at first, but now you have two copies of the source. Content, layouts, dependencies, and configuration can drift apart. Every shared change has to be copied over, and a production fix can get left out of staging (or the other way around).
Two source repositories make sense when the sites really are different products or have different owners. For one site with two release states, one source repository with main and production branches is usually cleaner.
Questions to Ask Before You Build
Is the source repository allowed to be public? If not, don’t plan on GitHub Free for Pages.
Do we need a server runtime or database? If yes, Pages can host only the static part.
Which branch is allowed to publish production? Write the rule into both the workflow and the environment policy.
What can the cross-repository credential write? Limit it to the deployment repository and the fewest permissions that still get the job done.
Do we need two source repositories? Only when the sites are truly separate products. Needing different URLs for staging and production isn’t a reason.
Bottom Line
For a static or Jekyll site, GitHub Pages can handle staging and production for very little infrastructure cost. The pattern I’d trust is one source repository with a review branch and a production branch, separate deployment repositories, branch-aware Actions, and promotion through a pull request.
The free option has real limits. Public source, public sites, DNS work, no server-side runtime, and cross-repository credentials all belong in the decision. If the project fits inside those limits, the setup is simple, and small teams get a safer path from local development to public release.
Frequently Asked Questions
Yes. Use separate Pages repositories or sites, then have GitHub Actions build the source and publish the generated files to the right deployment repository. The source branch decides whether the output goes to review or to the public.
No. GitHub Free supports Pages from public repositories. A public Pages site is public and has no built-in password protection. GitHub Pro supports Pages in private repositories, but private site access still requires the right organization and Enterprise Cloud setup.
No. GitHub Pages hosts static output such as HTML, CSS, JavaScript, and generated Jekyll files. If a site needs a server runtime, private application logic, or a database, those parts need a different hosting service.
References
- GitHub. (2026). Using Custom Workflows with GitHub Pages. GitHub. https://docs.github.com/en/pages/getting-started-with-github-pages/using-custom-workflows-with-github-pages
- GitHub. (2026). Setting Up a GitHub Pages Site with Jekyll. GitHub. https://docs.github.com/en/pages/setting-up-a-github-pages-site-with-jekyll
- GitHub. (2026). Using Secrets in GitHub Actions. GitHub. https://docs.github.com/en/actions/how-tos/write-workflows/choose-what-workflows-do/use-secrets
- GitHub. (2026). Managing Your Personal Access Tokens. GitHub. https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens
- GitHub. (2026). Managing Environments for Deployment. GitHub. https://docs.github.com/en/actions/how-tos/deploy/configure-and-manage-deployments/manage-environments
- GitHub. (2026). Configuring a Custom Domain for Your GitHub Pages Site. GitHub. https://docs.github.com/en/pages/configuring-a-custom-domain-for-your-github-pages-site
- GitHub. (2026). GitHub’s Plans. GitHub. https://docs.github.com/en/get-started/learning-about-github/githubs-plans
- GitHub. (2026). GitHub Pages Limits. GitHub. https://docs.github.com/en/pages/getting-started-with-github-pages/github-pages-limits
- GitHub. (2026). What Is GitHub Pages?. GitHub. https://docs.github.com/en/pages/getting-started-with-github-pages/what-is-github-pages





