Hi,
within the project settings, you can specify wildcards for branch names. If you’d just use *
, any branch is protected.
https://docs.gitlab.com/ee/user/project/protected_branches.html#wildcard-protected-branches
This must be done for each project though, there’s a feature request to manage this on the group/instance level: https://gitlab.com/gitlab-org/gitlab/issues/18488
If you prefer an automated fashion, use the REST API and iterate over all projects and set the protected branches this way: https://docs.gitlab.com/ee/api/protected_branches.html
Cheers,
Michael