`git push` fails with `remote: error: GH013: Repository rule violations found for refs/heads/main.` and `- Changes must be made through a pull request.`
BeginnerTroubleshootingGitHub, Actions and Pull Request Issues
Answer
Likely causes → A repository or organization ruleset blocks direct pushes to main (or requires signed commits, linear history, specific commit message patterns). Other bullet lines in the output show which rule failed.
Diagnose → Read every remote: bullet, then check the active rules:
gh api repos/org/repo/rules/branches/main --jq '.[].type'
Fix → Push to a branch and open a PR:
git switch -c fix/config
git push -u origin fix/config
gh pr create --fill
Then reset local main to origin/main so it doesn't drift.
Prevent → Never commit on local main; start every change with git switch -c.
More on GitHub, Actions and Pull Request Issues
A workflow step that pushes a version bump fails with `remote: Permission to org/repo.git denied to github-actions[bot].` and `The requested URL returned error: 403`.IntermediateA workflow pushes a commit or tag, but the workflow that should run on that push or tag never starts.IntermediateA container job fails on any Git command with `fatal: detected dubious ownership in repository at '/__w/app/app'`.IntermediateYour PR suddenly shows 340 changed files and dozens of commits you did not write.IntermediateThe PR is stuck on `Expected — Waiting for status to be reported` for a required check called `build`.IntermediateThe PR was approved, but merging shows "Review required" again after you pushed a small fix.Beginner