Protect all branches of gitlab

Hi. Can anyone please suggest how to protect all branches by default? If a new branch is created by project maintainer or owner, it should be created as a protected branch, as it is done for the main branch. Thank you.


within the project settings, you can specify wildcards for branch names. If you’d just use *, any branch is protected.

This must be done for each project though, there’s a feature request to manage this on the group/instance level:

If you prefer an automated fashion, use the REST API and iterate over all projects and set the protected branches this way:


Thank you very much. I will look into this.

With Best Regards,