[Other doc versions]
Branch permissions allow you to control who can commit to specific branches in a repository. Branch permissions provide another level of security within Stash (along with user authentication and project, repository and global permissions) that provides a way to control, or enforce, your own workflow or process.
If a user does not have commit access to the branch, an error message will be shown on the Git command line when they try to push a change to the branch.
Note that if no branch permissions are defined then anyone with commit access can push to any branch. Also, if there are conflicting permissions, the most permissive one applies; for example if one permission restricts a particular users access but another permission allows it, then the user will be allowed commit access.
Branch permissions in Stash are set on a per-repository basis. Makes sense – branch permissions control access to repository branches, right?
You'll need either project admin, admin or sys-admin permissions to set branch permissions.
So, to set branch permissions:
You can always change the permissions for a branch later, if necessary.
Advanced branch permissions specify a pattern that is matched against branches and tags being pushed to Stash; this allows you to restrict any pushes to branches that match the pattern.
Advanced branch permission also apply to attempts to create new branches; if a push to Stash attempts to create a new branch that matches a pattern, the user must be authorised for the operation to proceed.
To set advanced branch permissions, choose Settings > Branch, and click Add permission, as described above.
On the Advanced tab, enter a glob pattern to match the names of multiple branches for which you want to control access.