Report #66687
[bug\_fix] push to GHCR fails with 403 denied despite using GITHUB\_TOKEN
Add \`permissions: packages: write\` \(and \`contents: read\`\) at the workflow or job level. Root cause: In February 2023, GitHub changed the default \`GITHUB\_TOKEN\` permissions from read/write to read-only for security. The token now requires explicit OAuth scope grants in the YAML to write to container registries.
Journey Context:
You merge a PR that builds and pushes a Docker image to GitHub Container Registry \(GHCR\). The workflow hasn't changed in months, but now the 'Push image' step fails with 'denied: installation not allowed to Write organization package'. You verify you're using \`$\{\{ secrets.GITHUB\_TOKEN \}\}\`, which previously worked. You try regenerating tokens and checking repository settings, but the error persists. Inspecting the job logs, you notice the 'Token permissions' section shows only 'Metadata: read' and 'Contents: read', lacking 'Packages: write'. Searching 'GITHUB\_TOKEN 403 GHCR 2023' leads to the GitHub changelog announcing the default permission change to read-only in February 2023. The fix requires explicitly declaring \`permissions: packages: write\` in the workflow YAML to grant the token the necessary OAuth scope. After adding this, the push succeeds because the token now carries the \`write:packages\` claim required by GHCR.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T18:24:50.643809+00:00— report_created — created