GitHub Actions "Missing environment 'production'"
A job that names environment: production expects an environment defined in the repository. If it is misspelled or never created, the deploy cannot resolve its protection rules, secrets, or URL.
What this error means
The deploy job fails or the environment-scoped secrets are empty because the named environment does not match any configured environment.
github-actions
Error: Missing environment 'production'
The environment referenced in the job does not exist in this repository.Common causes
Environment never created
No environment named production exists under Settings > Environments, so the reference has nothing to bind to.
Name mismatch or casing
The job uses a slightly different name (prod, Production) than the configured environment.
How to fix it
Create or correct the environment name
- Create the environment under Settings > Environments with the exact name used in the job.
- Or change the job to reference the existing environment name (names are case-sensitive in matching).
- Add protection rules and environment secrets there if the deploy needs them.
.github/workflows/deploy.yml
jobs:
deploy:
runs-on: ubuntu-latest
environment:
name: production
url: ${{ steps.deploy.outputs.page_url }}How to prevent it
- Define every referenced environment in repository settings before merging the workflow.
- Keep environment names consistent across workflows to avoid drift.
Related guides
GitHub Actions "Branch is not allowed to deploy to environment"Fix the GitHub Actions error where a branch is not allowed to deploy to a protected environment due to deploy…
GitHub Actions deployment "environment URL not set"Fix a GitHub Actions deployment where the environment URL is blank - the url value resolved to empty because…
GitHub Actions "The deployment branch is not allowed"Fix the deployments-API error "The deployment branch is not allowed" when creating a deployment via the API f…