# GitHub Actions: Error: Failed to create deployment (status: 404) — Ensure GitHub Pages has been enabled

**Code:** `Failed to create deployment (Pages not enabled)` · **Category:** CI/CD · **Seen on:** GitHub Actions

The Pages deploy step cannot create a deployment because Pages is not enabled for the repository, or is not set to "GitHub Actions" as its source.

## Meaning

`actions/deploy-pages` needs Pages enabled with Source = GitHub Actions, plus permissions `pages: write` and `id-token: write`, and an `environment: github-pages`. A 404 almost always means the setting is missing; a 403 means permissions or branch protection on the environment.

## Common causes

- Pages not enabled, or source set to "Deploy from a branch" instead of "GitHub Actions"
- Missing `pages: write` / `id-token: write` permissions
- Job lacks `environment: github-pages`
- Environment protection rules forbid the branch
- Repository is private on a plan without Pages

## Quick fix

1. Settings → Pages → Source: GitHub Actions
2. Add `permissions: { pages: write, id-token: write }`
3. Set `environment: name: github-pages`

## Detailed fix by platform

### GitHub Actions

1. Use the official trio: `actions/configure-pages`, `actions/upload-pages-artifact`, `actions/deploy-pages`

## Code examples

### Pages deployment job

```yaml
permissions:
  contents: read
  pages: write
  id-token: write
jobs:
  deploy:
    environment:
      name: github-pages
      url: ${{ steps.dep.outputs.page_url }}
    runs-on: ubuntu-latest
    steps:
      - uses: actions/deploy-pages@v4
        id: dep
```

## How to diagnose

1. **Setting** — Pages source set to GitHub Actions?
2. **Permissions** — pages and id-token write?
3. **Environment** — github-pages allowed for this branch?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/cicd/gha-pages-deploy-failed)
