If a Stash project grants write permission to all it's repositories, I don't believe it is possible to remove that access at the repo level, or at least not in Stash, as the hierarchical permission model only works when adding privileges, not removing them. Am I right?
If that is the case, then what is the best way of preventing write access at the git repo level - i.e. applied to the Stash-managed git repo - perhaps for a period of maintenance? I know that a pre-receive hook might prevent pushing, but is there an easier method, that might even stop pulls and clones? BTW I don't much like the Stack Control recommendation of using chmod to do this because it might be difficult to revert to the previous settings when chmod'ing the whole repo directory.
To prevent write access, you could create a Branch Permission that matches against * and restricts updates to just yourself or potentially an empty group. That will block any tag or branch update, effectively making it a read-only repository.
To prevent read access, you'd need to actually remove the read permission. One way to do this without messing with your project permissions is to create a "Read-only" project and physically move the repository into it, and then move it back when you're done with the maintenance.
Hi Tim, Thanks for these suggestions - I had half thought of the branch idea after posting the question, but the second may be better if I wanted to prevent any pull or clone as well since existing urls would be wrong until I put it back again. This certainly would have been best for the particular circumstance I found myself in that prompted the question - I was using BFG to remove a 1.4Gb file that had been unwittingly committed and pushed - the removal was successful! Regards, John
This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.Read more
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 ...
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!
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