Stash: Branch permission set via REST API not working


when I set branch-permissions for my repository using the REST Api, users are still able to push directly to the branch, even if they shouldn't. In the stash UI, permissions are displayed like they should. When I resave the permissions manually, without making any modifications, the restrictions work as expected. Is this a bug in stash (using the latest version) or do I need to do something to make my changes actually apply?

2 answers

1 accepted

This widget could not be displayed.

Oh now I see what I did wrong. I didnt use fully qualified branch names. Instead of refs/head/master I just used "master"

This widget could not be displayed.

For me this:

curl -i -u user:pass -H "Accept: application/json" -H "Content-Type: application/json" -X POST -d "{\"type\": \"BRANCH\",\"value\": \"refs/heads/something\",\"groups\":[\"Group\"],\"users\":[\"user1\",\"user2\",\"user3\",\"user4\",\"user5\"]}" http://stash/rest/branch-permissions/1.0/projects/PROJECT/repos/REPO/restricted

works perfectly, with Stash 3.5.1

Can you post the exact command and your Stash version?

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Aug 21, 2018 in Bitbucket

Branch Management with Bitbucket

As a project manager, I have discovered that different developers want to bring their previous branching method with them when they join the team. Some developers are used to performing individual wo...

1,203 views 8 10
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