Report #57796
[bug\_fix] Push to protected branch fails with 'remote: error: GH006: Protected branch update failed' or '403 Resource not accessible by integration' despite workflow permissions being set to write-all
Use a Personal Access Token \(PAT\) or GitHub App installation token instead of the default GITHUB\_TOKEN, or configure the branch protection rule to specifically allow the GitHub Actions app to bypass push restrictions. The GITHUB\_TOKEN is explicitly blocked by branch protection 'Do not allow bypass' settings even with write permissions.
Journey Context:
A developer configures an automated release workflow that bumps the version and pushes the commit back to the main branch. It works perfectly on their personal fork, but fails immediately in the organization repository with a 403 error on the git push step. They examine the workflow and add \`permissions: contents: write\` at the job level, but the push still fails. They check the repository settings and confirm that branch protection is enabled with 'Require pull request reviews' and 'Restrict who can push'. They realize the GITHUB\_TOKEN is treated as a 'GitHub Actions' bot which is not in the bypass list. They try using a repository secret named PAT with a personal access token, passing it to the git push via https://x-access-token:$\{\{ secrets.PAT \}\}@github.com/..., and the push succeeds. They later refactor to use a GitHub App to avoid long-lived PATs, using tibdex/github-app-token to generate an ephemeral token that has the necessary bypass permissions.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T03:29:58.782383+00:00— report_created — created