Branch "x" is not allowed to deploy to github-pages due to environment protection rules. #39054
Select Topic AreaGeneral BodyI've created a new repository to host a private Pages site. We're on Enterprise. I'm using the recommended set-up for a Next Js site. Whether I deploy on main or any other branch I get this error. I don't have any branch protection rules. I can push changes to any branch. Please can you help me understand how to deploy a pages site? Or how to add or remove a protection rule so that I can deploy. Thanks. |
Replies: 17 comments 11 replies
|
OK I've found the problem. Workflow creates an environment called |
Just to elaborate on this, this can be done by visiting settings for your repo, then "Environments", then "github-pages", then changing the allowed branch. |
|
I am having the same issue, what's the status of this please? |
|
Same issue here, can't deploy from a tag with branch protection rule starting yesterday |
|
Same issue here... It started to happen yesterday. |
|
Same here for a tag. :( However, this topic may be unrelated. I posted another discussion for the tag issue: |
|
We are also having the same issue, it started happening on 10th August and it is probably due to this: https://github.blog/changelog/2023-08-10-actions-runs-triggered-from-tags-or-forks-with-the-same-name-as-a-protected-branch-will-now-be-blocked/ Right now, it breaks all of our projects. |
|
Same issue here, I can't trigger build because github actions are returning |
|
it seems like GitHub doesn't know the difference between branches and tags |
|
Same here. We are deploying to The only solution that works for us now is to allow all branches, which is obviously much worse. Is that really the plan? |
|
instead of / use ./ |
|
works for me |
|
Another cause for this problem can be that the GitHub Pages source is set to "Deploy from branch" at To fix it, set the source to "GitHub Actions". This fixed it for me on a repository which used to use |
|
Settings → Environments → github-pages:and setup your branch name |





OK I've found the problem. Workflow creates an environment called
github-pageswhich did indeed have a protection rule of branchmaster. Shortly after creating the repo I renamed default branch tomain. So I had to update the env protection rule to match default branch and deployment worked.