Share your work as a public website — even from a private repo
GitHub Pages lets you turn any folder in a repository into a live public website — for free. This is how you'll share your project outputs, dashboards, and reports.
Once Pages is enabled, your site is served at:
https://<username>.github.io/<repo-name>/
Files are accessible by appending their path to that base URL:
index.html at the root of your published folder is served at the
base URL — no filename needed. It's the default landing page.map.html, is accessible at:https://<username>.github.io/<repo-name>/map.html
results/summary.html, is at:https://<username>.github.io/<repo-name>/results/summary.html
Tip: rename your main output file index.html so you can share a
clean, memorable link.
You can designate any folder (e.g. docs/ or output/) as the root of
your published site. Only the files in that folder become public — your notebooks, raw data,
and source code stay private.
A common pattern:
docs/ folderdocs/ via GitHub PagesThis gives collaborators and instructors a clean public URL pointing directly to your results.
This approach uses the GitHub website — no terminal required.
Make sure your output file (e.g. docs/index.html) is committed and pushed to
GitHub.
.github/workflows/ in your repo. Every time you push to the main branch, this
workflow automatically deploys your site.
If you want to publish only a subfolder (e.g. docs/), edit the workflow YAML
before committing. Find the path line under the upload step and change it:
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: './docs' # <-- change this to your folder
After the workflow runs (usually under a minute), go back to Settings → Pages. Your live URL is displayed at the top of the page.
You can ask a coding agent (like GitHub Copilot in VS Code, or Claude Code) to set up GitHub
Pages for you using the gh command-line tool. This is faster and avoids
navigating the GitHub UI.
ghOpen the chat with your coding agent and paste this prompt:
gh) on my machine. Check whether it's already
installed first. If not, install it using the appropriate method for my operating system
(Homebrew on Mac, apt or winget on Windows, etc.). Then authenticate it by running
gh auth login and walk me through the steps.
gh stores credentials securely.
Once gh is authenticated, give the agent this prompt:
gh CLI to enable GitHub Pages for this repository. Publish the contents
of the docs/ folder (create it if it doesn't exist and move my HTML output
files there). Set up the modern GitHub Actions workflow for deployment, not the legacy
branch-based approach. Then tell me the public URL where my site will be live.
The agent will typically:
.github/workflows/pages.yml workflow filegh api commands to enable Pages on the repoAsk the agent to check that the deployment succeeded:
gh run list to check the status of the Pages deployment workflow. Once it
shows as completed, confirm the site URL with gh api repos/{owner}/{repo}/pages
--jq '.html_url'.
gh without any
manual steps.
For reference, here is the standard workflow that both methods produce. It lives at
.github/workflows/pages.yml in your repo:
name: Deploy to GitHub Pages
on:
push:
branches: ["main"]
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
deploy:
environment:
name: github-pages
url: $
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: './docs' # change to '.' to publish the whole repo root
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
Change path: './docs' to any folder you want to publish,
or use '.' for the entire repo root.
| Goal | How |
|---|---|
| Find your Pages URL | Settings → Pages, or gh api repos/{owner}/{repo}/pages --jq '.html_url' |
| Make a file the homepage | Name it index.html in your published folder |
| Link to a specific page | Append filename: .../repo/map.html |
| Publish only some files | Put them in docs/, set path: './docs' in workflow |
| Keep source code private | Private repo is fine — Pages content is always public |
| Trigger a redeploy | Push any commit to main, or run gh workflow run pages.yml |