Stash: Branch permission set via REST API not working

Hello,

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

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

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
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jun 12, 2018 in Bitbucket

Do you use any Atlassian products for your personal projects?

After spinning my wheels trying to get organized enough to write a book for National Novel Writing Month (NaNoWriMo) I took my affinity for Atlassian products from my work life and decided to tr...

23,629 views 26 12
Join discussion

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