Can Stash (or a Stash hook) manage commit permissions on specific files or directories?

We have certain files/directories within a branch that can only be modified by special users. This was easy in SVN - but I can not find a way to do this in Stash.

Any suggestions?



1 answer

1 accepted

Hi Jon,

This is obviously not possible in Stash at this stage.

It could be done fairly easily as a plugin. You could add a pre-receive hook that looks at the new commits, calculates what files/directories have been modified and rejects/accepts the push accordingly. Here is an example of a hook I wrote that blocks pushes with large files, which might be a good place to start

That said, my advice would be to split up your repository into smaller repositories and define your permissions at that level. This is something that will play better with Stash (and most other Git hosting solutions which don't support this feature either). At this point you could have repository write permissions (or branch permissions on master) and only certain people can push/merge to them.



Thanks Charles - we will investigate breaking the areas into seperate repos.



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...

171 views 20 8
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