OxyPages

From Claude Code To GitHub Pages, Step By Step

From Claude Code To GitHub Pages, Step By Step

Get a site from Claude Code to GitHub Pages: the repo, the Actions workflow, the base path that blanks your page, and GitHub Free's rules. Plus a shorter route.

The OxyPages Team · · 7 min read

Claude Code built you a site, and you'd like it on GitHub Pages. Maybe a friend said it's free. Maybe the code is going on GitHub anyway, so it feels like the obvious home.

It's a fair choice. GitHub Pages is free for public repositories, it's run by a company that isn't going anywhere, and Claude Code can do nearly all the work: create the repository, write the workflow, push the code. You flip one setting yourself.

The part nobody warns you about is the address. A Pages site usually lives in a subfolder, your-name.github.io/your-repo/, and a site built with Vite or React doesn't know that unless you tell it. Skip that step and you get a perfectly deployed blank page.

This post takes a site from Claude Code to GitHub Pages in order, with the exact files and the exact things to ask for. Then it covers the two rules on GitHub Free that decide whether Pages is the right home at all, and the shorter route for when you don't want a repository yet.

TL;DR: To publish a Claude Code project on GitHub Pages: push the code to a public repository (GitHub Free only publishes Pages from public ones), set base in vite.config to '/your-repo/', add a GitHub Actions workflow that runs npm ci and npm run build and uploads dist, then set Settings, Pages, Source to GitHub Actions. Claude Code can do every step except that last setting. GitHub says Pages is not for running an online business or a shop, and sites from a private repository are still public. If you only need a link today, a no-account deploy skips the repository entirely.

What You Need Before You Start

Three things, and Claude Code can check all of them for you.

  • A GitHub account. Free is fine for a public project.
  • Git on your computer. Ask Claude Code to run git --version. If it isn't installed, it'll tell you how.
  • Optional: GitHub's gh command-line tool, signed in. With it, Claude Code can create the repository itself. Without it, you create an empty repository on github.com and paste Claude the address.

And one decision. The repository has to be public on GitHub Free to publish Pages from it. If the code can't be public, you either pay for a GitHub plan that allows private Pages sources or pick a different host. GitHub's own warning is worth knowing too: a site published from a private repository is still a public website.

If the site is a single HTML file rather than a built project, most of this post doesn't apply. The GitHub Pages limits, and the no-git browser route covers that simpler case and the full list of GitHub's rules.

Branch Or Actions: Which Source Should You Pick?

Branch Or Actions: Which Source Should You Pick? - OxyPages

GitHub Pages can publish in two ways, and for anything Claude Code built with a framework, the answer is GitHub Actions. Vite's own deployment guide says the same, because the site has to be built before it can be served.

Deploy from a branchGitHub Actions
Who builds the siteNobody, unless it's a Jekyll site, which GitHub buildsA workflow file you add, running npm run build
Works for a Vite, React or Astro projectOnly if you commit the built dist folder yourselfYes, this is what it's for
Jekyll runs on your filesYes, by defaultNo
The soft limit of 10 builds an hourAppliesDoesn't apply to a custom workflow
What you set in Settings, PagesA branch and a folder"GitHub Actions"

A branch deploy is fine for plain HTML. For everything else, use Actions and let the build happen on GitHub.

Claude Code To GitHub Pages, In Order

Here's the full sequence. You can paste each step to Claude Code as its own request, or paste the whole list and let it work through it.

  1. Ask for a repository. "Create a public GitHub repository called family-recipes from this project and push it." With gh signed in, it runs something like gh repo create family-recipes --public --source=. --push. Without it, it adds the remote you give it and pushes.
  2. Set the base path. "Set base in vite.config to '/family-recipes/'." This is the step that stops the blank page. The value is your repository name with a slash on each side.
  3. Add the workflow. "Add a GitHub Actions workflow that deploys this Vite site to GitHub Pages, based on Vite's static deploy guide." The file goes at .github/workflows/deploy.yml.
  4. Push again. Claude commits the config change and the workflow and pushes them.
  5. Flip the setting yourself. On github.com, open the repository, then Settings, then Pages. Under Build and deployment, set Source to GitHub Actions.
  6. Watch it build. Open the Actions tab. When the run turns green, the site is at your-name.github.io/family-recipes/.

From then on, every push to main rebuilds and redeploys. Ask Claude to change something, commit and push, and the live site updates a few minutes later.

The Workflow File

This is the shape of the workflow Vite's guide publishes, as of 8 November 2026. The guide pins each action to an exact commit; tags are shown here so it's readable. Ask Claude to copy the current file from the guide rather than retyping this, since the versions move.

name: Deploy static content to Pages

on:
  push:
    branches: ['main']
  workflow_dispatch:

permissions:
  contents: read
  pages: write
  id-token: write

concurrency:
  group: 'pages'
  cancel-in-progress: true

jobs:
  deploy:
    environment:
      name: github-pages
      url: ${{ steps.deployment.outputs.page_url }}
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7
      - uses: actions/setup-node@v7
        with:
          node-version: lts/*
          cache: 'npm'
      - run: npm ci
      - run: npm run build
      - uses: actions/configure-pages@v6
      - uses: actions/upload-pages-artifact@v5
        with:
          path: './dist'
      - id: deployment
        uses: actions/deploy-pages@v5

If your project builds to build or out instead of dist, change the path line. That's the most common edit.

Vite's static deploy guide, including the GitHub Pages workflow

Why Is My GitHub Pages Site A Blank Page?

Almost always the base path. The build points to its scripts and styles at /assets/..., which on a project site means your-name.github.io/assets/..., the wrong folder. The page loads, the files it needs 404, and you see white.

Open the browser console on the live page. A row of red 404s for .js and .css files confirms it. Set base to '/your-repo/', push, and wait for the next run. The Vite base path, explained once and for all goes through every case, including custom domains, where the base goes back to '/'.

Pages That 404 When You Refresh

The second surprise comes later. If Claude built the site with page routes, like /recipes/lasagne, clicking through works but refreshing on one of those pages gives GitHub's 404. GitHub Pages has no setting to send every path back to your index.html.

The usual workaround is a copy of index.html saved as 404.html, so GitHub's "not found" page is your app. It works for visitors, though the server still reports a 404 status for those pages. Why built apps 404 on refresh, and the fix on each host covers the cleaner options.

Should Your Site Be On GitHub Pages At All?

Two rules decide it, and they're both easy to miss until they bite.

It has to be public, on GitHub Free. Not just the site: the repository, with every file and every commit. For a family recipe app, nobody cares. For a client's project, the client might.

It isn't for business. GitHub's limits page says Pages "is not intended for or allowed to be used as a free web-hosting service to run your online business", and extends that to shops and software sold as a service. A portfolio or a hobby project is fine. A storefront isn't.

If both rules are fine for you, I'd honestly stay. You get a free custom domain, free HTTPS and a host that's very likely to still be around in five years.

When A Repository Is More Than You Need

When A Repository Is More Than You Need - OxyPages

Sometimes you just want to see it online, today, without deciding on repositories, visibility or workflows. That's a different job, and there are hosts built for it.

Several now take a built site from an agent with no account at all, return a live link and a claim link, and let you decide later whether to keep it. With OxyPages, for example, Claude Code builds the project, zips the dist folder and sends it in one request, with nothing to install. Putting a Claude Code website online in one step walks through that route.

It's a test link first, though. An unclaimed one lasts 30 minutes, and keeping it means a free account. Our Free plan is personal and non-commercial, like GitHub's rule, and custom domains are on paid plans, where GitHub Pages gives them away. If you want a free site on your own domain for a public hobby project, GitHub Pages beats us on that.

What To Do Next

If the code can be public and the site isn't a business, go with GitHub Pages. Ask Claude Code for the repository, the base path and the workflow, flip Source to GitHub Actions, and watch the first run go green. Check the live page's console for 404s before you share the link.

If you'd rather see it online in the next minute and decide on a home afterwards, send the build and get a live link with a claim link.

FAQ

Can Claude Code Deploy To GitHub Pages By Itself?

Almost. It can create the repository, set the base path, write the workflow and push. You still set Settings, Pages, Source to GitHub Actions the first time, which takes a few seconds on github.com.

Is GitHub Pages Free?

Yes, for public repositories on GitHub Free. Publishing from a private repository needs a paid GitHub plan, and the site is public either way. GitHub also sets soft limits, including 100 GB of bandwidth a month.

Why Does My Site Work Locally But Not On GitHub Pages?

Usually because the site expects to live at the root of a domain and GitHub put it in a subfolder named after your repository. Setting base in vite.config to your repository name fixes the blank page. Refresh 404s on inner pages are a separate issue with their own fix.

Can I Use A Custom Domain With A Claude Code Site On GitHub Pages?

Yes. Moving from Claude Code to GitHub Pages doesn't stop you using your own domain. Add it in Settings, Pages, point a CNAME record at your github.io address, and set base back to '/', because the site now lives at the root of your own domain.

Try It Now

Still Here? Drop It In.

The whole pitch fits in one sentence: your HTML, on a link, in seconds.

Drag and drop your HTML files, a folder, a ZIP, your app's build folder, a PDF, an image or an MP3

or ·

No account needed. Your unclaimed website stays live for 30 minutes on a free subdomain. Claim it to your account to keep it permanently.

  • No Account Needed
  • Free SSL
  • 30-Minute Unclaimed Link, Claim To Keep It