Wildcard branch protection should allow branch creation #14216

Open
opened 2025-11-02 11:06:41 -06:00 by GiteaMirror · 2 comments
Owner

Originally created by @srodionov-cbtw on GitHub (Mar 4, 2025).

Feature Description

Given a branch protection rule with a wildcard like "release/**" and "disabled push",
as a developer without administrator privileges, I want to be able to create a new branch called release/whatever with the branch creation UI in gitea, as long as no such branch exists.

currently I get the error:
"Gitea: Not allowed to push to protected branch release/whatever"

I want the branch protection to protect existing branches only, while beeing able to create new branches, that once created automatically get the protection.
If necessary it could also be a configurable option, if the branch protection is applied to new branches.

Screenshots

No response

Originally created by @srodionov-cbtw on GitHub (Mar 4, 2025). ### Feature Description Given a branch protection rule with a wildcard like "release/**" and "disabled push", as a developer without administrator privileges, I want to be able to create a new branch called release/whatever with the branch creation UI in gitea, as long as no such branch exists. currently I get the error: "Gitea: Not allowed to push to protected branch release/whatever" I want the branch protection to protect existing branches only, while beeing able to create new branches, that once created automatically get the protection. If necessary it could also be a configurable option, if the branch protection is applied to new branches. ### Screenshots _No response_
GiteaMirror added the type/proposal label 2025-11-02 11:06:41 -06:00
Author
Owner

@jpraet commented on GitHub (Mar 6, 2025):

If this gets implemented, it should be made configurable. I'm using a branch protection for pattern *'* to prevent users from creating branches containing a ', because that causes issues in our CI system. Or an alternative solution should be provided to handle that requirement of enforcing naming conventions for branches.

@jpraet commented on GitHub (Mar 6, 2025): If this gets implemented, it should be made configurable. I'm using a branch protection for pattern `*'*` to prevent users from creating branches containing a `'`, because that causes issues in our CI system. Or an alternative solution should be provided to handle that requirement of enforcing naming conventions for branches.
Author
Owner

@adamel commented on GitHub (May 5, 2025):

As a workaround just create a branch with non-protected name and then rename to the protected name. This can be done by any user with write access to the repo.

@adamel commented on GitHub (May 5, 2025): As a workaround just create a branch with non-protected name and then rename to the protected name. This can be done by any user with write access to the repo.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#14216