GITHUB_TOKEN GHCR push "denied" without packages: write in CI
Pushing a container image to ghcr.io with GITHUB_TOKEN requires packages: write. Without it the registry returns a denied error during the push, even though docker login appeared to succeed.
What this error means
A docker push to ghcr.io fails with "denied: permission_denied" or "denied: installation not allowed to Create organization package", and the job has no packages: write.
denied: permission_denied: write_package
# or
denied: installation not allowed to Create organization packageCommon causes
GITHUB_TOKEN lacks packages: write
The push needs write access to GitHub Packages; without the scope the registry rejects the upload.
Org package settings block the token
Org-level package creation policy can refuse the Actions token from creating a new package.
How to fix it
Grant packages: write
- Add
packages: writeto the job permissions. - Log in to ghcr.io with GITHUB_TOKEN.
- Re-run the push.
permissions:
contents: read
packages: writeAllow Actions to manage the package
For org packages, ensure the package or org settings allow the repository's Actions to write, or pre-create the package and link the repo.
# Package settings > Manage Actions access
# add the repository with Write roleHow to prevent it
- Grant
packages: writefor image pushes to GHCR. - Link the package to the repo with Write access for org packages.
- Log in with GITHUB_TOKEN, not a stale PAT.