Skip to content

Is there a way to deny pushes but still allow merging PRs? #23713

Discussion options

You must be logged in to vote

@aaronfranke - Great question! Have you considered leveraging protected branches for your use case?

Protected branches ensure that collaborators on your repository cannot make irrevocable changes to branches. Enabling protected branches also allows you to enable other optional checks and requirements, like required status checks and required reviews. Our team wrote a guide for defining the mergeability of pull requests that may be worth checking out.

Once you have protected branches setup on your repository, those with write access will still be able to push to branches that are not protected, but any pushes from them attempting to update the protected branch(es) will be rejected.

If you’…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants