RuleSet not allowing direct push to branch #170970
-
Discussion TypeQuestion Discussion ContentHi, I have a question about rulesets. In my projects i have setup branch rulesets instead of the classic branch protections and I was expecting same behavior, but while I can direct push in classic branch protection, I get rejected under the ruleset branch. Is this expected? Both ruleset and classic branch protection is setup with same rules. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
|
Hey @rcampos87, Key difference:
For more details, see: Docs If you want behaviour more like classic protection, you may need to adjust your ruleset to allow direct pushes for certain roles or users. Hope this helps |
Beta Was this translation helpful? Give feedback.
-
|
Yes, this is expected behavior. GitHub branch protection rules and branch rulesets are related but not identical in how they enforce restrictions: Classic Branch Protection Some permissions, like “Allow direct pushes” for specific roles or users, can bypass certain protections. Legacy protections may allow more flexibility for maintainers or admins depending on the repository settings. Branch Rulesets Rulesets are more strict and consistent across multiple branches or patterns. If the ruleset explicitly prevents direct pushes, it will reject pushes even if you previously could push under classic protection. This is by design: rulesets prioritize enforceable consistency and can override legacy allowances. |
Beta Was this translation helpful? Give feedback.
-
|
Thanks for posting in the GitHub Community, @rcampos87! We're happy you're here. You are more likely to get a useful response if you are posting your question in the applicable category, the Discussions category is solely related to conversations around the GitHub product Discussions. This question should be in the |
Beta Was this translation helpful? Give feedback.
Hey @rcampos87,
Yes, this is expected behaviour. Although rulesets and classic branch protections seem similar, they are not identical in how they enforce rules.
Key difference:
For more details, see: Docs
If you want behaviour more like classic protection, you may need to adjus…