GitHub Pages shows your README instead of your Hugo site

Your repository is online, but Pages is serving the README instead of the Hugo build.

Last updated

You push your Hugo project to GitHub, enable Pages, and the site that comes up is your README.md – rendered as a web page, with the wrong theme and none of your content.

GitHub is processing the source branch with Jekyll instead of building Hugo. Without a generated index.html, the repository README becomes the page.

Why it happens

Pages has two very different modes:

  • Deploy from a branch – GitHub processes the selected branch with Jekyll. Hugo source files are not built unless the branch already contains generated HTML.
  • GitHub Actions – a workflow you supply builds the site and publishes the result. This is the mode a Hugo site wants.

If Pages serves main while that branch contains Hugo source rather than built files, it can publish the README instead of the site.

Fix: build with Actions

1. Add a workflow at .github/workflows/hugo.yml:

name: Deploy Hugo site to Pages
on:
  push:
    branches: ["main"]
  workflow_dispatch:
permissions:
  contents: read
  pages: write
  id-token: write
concurrency:
  group: "pages"
jobs:
  build:
    runs-on: ubuntu-latest
    env:
      HUGO_VERSION: 0.148.2
    steps:
      - name: Install Hugo
        run: |
          wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb
          sudo dpkg -i ${{ runner.temp }}/hugo.deb
      - uses: actions/checkout@v4
        with:
          submodules: recursive
          fetch-depth: 0
      - id: pages
        uses: actions/configure-pages@v5
      - run: hugo --gc --minify --baseURL "${{ steps.pages.outputs.base_url }}/"
        env:
          HUGO_ENVIRONMENT: production
      - uses: actions/upload-pages-artifact@v3
        with:
          path: ./public
  deploy:
    needs: build
    runs-on: ubuntu-latest
    environment:
      name: github-pages
      url: ${{ steps.deployment.outputs.page_url }}
    steps:
      - id: deployment
        uses: actions/deploy-pages@v4

Pin HUGO_VERSION to the version you build with locally, and use the extended build if your theme compiles SCSS – most do.

2. Switch the Pages source. Open Settings → Pages → Build and deployment → Source and select GitHub Actions.

3. Push. The workflow runs on every push to main from now on.

The other way: push the built site

If you’d rather build on your own machine, push only the contents of public/ to a gh-pages branch and point Pages at that branch. Add an empty .nojekyll file at its root – otherwise Jekyll will still process the output and quietly drop every file and folder that starts with an underscore.

Use either GitHub Actions or a built gh-pages branch as the Pages source, not both.

Still the README?

  • Check Settings → Pages again – the source really does reset when a repository is renamed or transferred.
  • Check that the workflow run actually succeeded, under the Actions tab.
  • Give it a minute. GitHub’s CDN can serve the old page briefly after a successful deploy.

In HugoKit: connecting a GitHub Pages target creates the selected workflow or branch setup and configures the matching Pages source.

Latest release · 9 August 2026

HugoKit 0.4.0

Adds search, find and replace, an outline, backlinks and page resources to the editor, and shows what a publish will change before it happens.

  • 01 Find and replaceSearch the Content list, then find and replace inside the open Raw document.
  • 02 Page resourcesThe files in a page's bundle, with Quick Look and insert-a-reference.
  • 03 Review ChangesSee what publishing would add, change and delete on each target.