Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Protect branch in Github results in "Rule is invalid"

Tags:

branch

github

I'm trying to create a simple rule to protect the main branch of a repository but it results in Rule is invalid. I am the creator of the repo. Using GitHub Enterprise Server 2.22.6.

What am I missing?

Steps:

  1. Settings
  2. Branches
  3. New Rule
  4. Name the rule Enter branch name to protect (answer)
  5. Select Require pull request review before merging

enter image description here

  1. Create

Error: Rule is invalid

enter image description here

like image 778
ericOnline Avatar asked May 06 '21 18:05

ericOnline


People also ask

How do I push a protected branch in a GitHub action?

Push Protected - GitHub Action. Push to "status check"-protected branches. Push commit(s) to a branch protected by required status checks by creating a temporary branch, where status checks are run, before fast-forward merging it into the protected branch, finally removing the temporary branch.

How are protected branches updated?

Require pull request reviews before merging If you enable required reviews, collaborators can only push changes to a protected branch via a pull request that is approved by the required number of reviewers with write permissions.


2 Answers

Try entering a regular expression or the name of the branch you'd like to protect (e.g. main instead of Protect Master) into the Branch name pattern textbox.

See the docs here for more information.

like image 124
Adil B Avatar answered Nov 10 '22 23:11

Adil B


For anyone still struggling with this. Make sure there is no space in your rule name.

ie:

"Protect Main" -> error

"ProtectMain" -> fine.

like image 29
Ricky Gummadi Avatar answered Nov 10 '22 23:11

Ricky Gummadi