Branch permissions not working

Hi, I've been testing branch permissions on Stash v2.5 and I can't make it work. I've tested giving only read permissions on a certain repo R to a certain user U, but adding a permission to a B branch. Trying to push to branch B using U, I get "Insufficient permissions", the same happens when I try using Advanced permissions and specify a regular expression.

I also tryed giving read permissions on the project level, getting the same results. If I give write permissions to U either on Project or Repo level I can obviously push on B but also on any other branch. I don't know what I am doing wrong really, is there a bug? Is there a missing configuration somewhere?

Thanks!

3 answers

This is what I did to make it work

stash permissions

Lock down master

Dev open

global perms

stash-users group

Project perms

write

Repo perms

Read

Branch perms

Add user/group to allow or prevent

0 vote
Jason Hinch Atlassian Team Jul 23, 2013

Branch permissions are in fact restrictions on top of project and repository level permissions. In order to write to a repository you still require write access to the project or repository. Branch permissions allow you to restrict this access so that only select people can push to specific branches.

Put another way both repository permissions and then branch permissions are checked independently of each other. When you push it is first checked that you have write access then afterwards it is checked which branches you are updating and whether you have an associated branch permission to update the branch.

Thanks for the answer Jason, so what you are saying is that if I have a Branch B on Repo R with permission for only user U1, and I have U2 with write permissions for B and not for B, he will not be apbe to push on B? In other words Repo permission are not inhereted to Branches? Or at least not to branches that have literal permissions?

sorry I meant "..I have U2 with write permissions for R and not for B, he will not be able to push to B"

Jason Hinch Atlassian Team Jul 24, 2013

Correct, the second user will not be able to push to the branch in that situation

I am going to pipe in here. I have the following in an Eval version of 2.6

Project - User A has read permissions

Repo - User A has read permissions

Branch A of repo - User A has permissions

Branch B of repo - User A has no permissions

I am not able to write to either branch of the repo.

What I need to be able to do is have a project with one repo under it and 2 branches of that repo called

dev

master

Dev is open to user to A to push to

Master needs to be locked down to User A.

How would I set up these permissions?

Thanks,
Devin

0 vote
Kay Jay I'm New Here Jan 17, 2018

Same situation here.

Branch permission doesn't work.

Suggest an answer

Log in or Join to answer
Community showcase
Piotr Plewa
Published Dec 27, 2017 in Bitbucket

Recipe: Deploying AWS Lambda functions with Bitbucket Pipelines

Bitbucket Pipelines helps me manage and automate a number of serverless deployments to AWS Lambda and this is how I do it. I'm building Node.js Lambda functions using node-lambda&nbsp...

716 views 0 4
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot