Report #74651
[bug\_fix] Push to protected branch fails with 'remote: error: GH006: Protected branch update failed' despite GITHUB\_TOKEN having write permissions
Do not use GITHUB\_TOKEN for pushes to branches protected by 'Restrict who can push to matching branches' or 'Require pull request reviews before merging'. Instead, use a Personal Access Token from a user who has bypass permissions, or use a GitHub App installation token, or configure the branch protection rule to allow force pushes \(not recommended\) or specifically allow the GitHub App.
Journey Context:
An automated release workflow calculates the next semantic version, commits the version bump to package.json, and pushes to the main branch. The push step fails with 'GH006: Protected branch update failed for refs/heads/main' and 'error: 403 Forbidden'. The developer confirms that the workflow permissions are set to contents: write and the GITHUB\_TOKEN is configured. They verify that manual pushes by human users work. After researching, they realize that the main branch is protected with 'Restrict who can push to matching branches' allowing only the 'Release Managers' team. The GITHUB\_TOKEN is not a member of this team and cannot bypass protections. The developer creates a Fine-Grained PAT for a service account that is in the Release Managers team, stores it as RELEASE\_PAT, and uses it in actions/checkout with token: $\{\{ secrets.RELEASE\_PAT \}\}, after which the push succeeds.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T07:54:02.194333+00:00— report_created — created