Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Servers, nginx and Docker

actions/configure-pages fails with 'Get Pages site failed'

ErrorGet Pages site failed. Please verify that the repository has Pages enabled and configured to build using GitHub Actions

Short answer

configure-pages asks GitHub for the repository's Pages site. If Pages is not switched on with the GitHub Actions source, the call fails. In Settings, Pages, set Source to GitHub Actions, and give the job pages: write and id-token: write. The enablement input can turn Pages on, but it needs a token other than GITHUB_TOKEN.

  • Applies to GitHub Actions, actions/configure-pages v5
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Read the full error line in the failed step. It names what the action tried (get or create) and prints the underlying message.

    gh run view --log-failed | grep -i 'pages site'
  2. 2Match what you see, then jump to its fix

    1. 1Get Pages site failed. Please verify that the repository has Pages enabled and configured to build using GitHub ActionsPages is not enabled, or its source is not GitHub ActionsFix
    2. 2The workflow has no permissions block, or one without pages and id-tokenThe job lacks the permissions a Pages workflow needsFix
    3. 3A new repository, Pages never switched on, and you do not want to click through SettingsYou want the workflow to enable Pages itselfFix

What does the error look like?

  • Get Pages site failed. Please verify that the repository has Pages enabled and configured to build using GitHub Actions
  • Create Pages site failed
  • Error: Get Pages site failed

Cause 1 of 3

Pages is not enabled, or its source is not GitHub Actions

1Check

Open the repository Settings, then Pages, and read the Source setting under Build and deployment.

gh api repos/OWNER/REPO/pages

2Fix

Set Source to GitHub Actions (Settings, Pages, Build and deployment). Re-run the workflow.

# Settings > Pages > Build and deployment > Source: GitHub Actions
gh run rerun --failed

3Verify

The configure-pages step passes and prints a base URL.

gh run view --log | grep -i base_url

Confirmed by docs.github.com

Did this fix it?

Cause 2 of 3

The job lacks the permissions a Pages workflow needs

1Check

The custom-workflow docs say the job needs at least pages: write and id-token: write. A restricted default token has neither.

grep -n -A6 'permissions:' .github/workflows/*.yml

2Fix

Add the permissions to the deploy job (or the workflow).

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

3Verify

Re-run; the step no longer fails on access.

gh run rerun --failed

Confirmed by docs.github.com

Did this fix it?

Cause 3 of 3

You want the workflow to enable Pages itself

1Check

configure-pages has an enablement input, default false. It tries to enable Pages, and it requires a token other than GITHUB_TOKEN.

grep -n -B2 -A6 'configure-pages' .github/workflows/*.yml

2Fix

Store a personal access token (repo scope or Pages write) or a GitHub App token (administration:write, pages:write) as a secret and pass it with enablement: true. Switching Pages on once in Settings is usually simpler.

- uses: actions/configure-pages@v5
  with:
    enablement: true
    token: ${{ secrets.PAGES_ADMIN_TOKEN }}

3Verify

A first run creates the site; later runs can drop enablement.

gh api repos/OWNER/REPO/pages --jq .html_url

Confirmed by raw.githubusercontent.com

Did this fix it?

How do I stop it coming back?

  • Switch Pages to the GitHub Actions source before the first deploy run.
  • Keep pages: write and id-token: write only on the deploy job.
  • Do not store an admin token only to automate a setting you change once.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Related fixes

Servers

docker pull or push to ghcr.io fails with 'denied'

Error response from daemon: denied

ghcr.io refuses a pull or push when Docker is not logged in, when the token lacks the package scope, or when the workflow's GITHUB_TOKEN has no packages permission or no access to that package.

4 causes, each with a fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.