Interview Prep/Git & GitHub/GitHub, Actions and Pull Request Issues

`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.

All Git & GitHub questions Roadmap: Git & GitHub

More on GitHub, Actions and Pull Request Issues