ad-m/github-push-action "remote rejected" on a protected branch
Branch protection can require reviews, status checks, or block force pushes. A bot push that violates a rule is rejected by the protected-branch hook regardless of token scope.
What this error means
The push step fails with "[remote rejected]" and "protected branch hook declined".
! [remote rejected] HEAD -> main (protected branch hook declined)
error: failed to push some refs to 'https://github.com/owner/repo'Common causes
Required reviews on the branch
A direct push to a branch requiring PR review is declined.
Required status checks not satisfied
Pushing to a branch that requires passing checks is blocked.
Force push disallowed
Protection forbids force pushes, so a non-fast-forward push is rejected.
How to fix it
Push to a feature branch and open a PR instead
- Have the workflow push to a new branch rather than the protected default.
- Open a PR from that branch (or use create-pull-request) for the protected target.
- Re-run; the push targets an unprotected branch.
- uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: automated/bot-updateHow to prevent it
- Route automated changes through PRs to protected branches, not direct pushes.
- Add the bot/app to the protection bypass list only when a direct push is truly required.