Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any way to set a Git branch as readonly with Stash?

Tags:

git-stash

In our office we are using Stash without server access (maximum access level is create branch) so we need to restrict a particular Git branch from the pushes. So simply, what we need to do is we need to freeze our branch after the release.

Currently what we are doing is we replicate the feature branch and remove that branch from the remote, but that is bit risky.

Are there any other possible solutions?

like image 615
Lasitha Benaragama Avatar asked Dec 20 '25 21:12

Lasitha Benaragama


2 Answers

You should be able to associate to that branch a permission which suits your need.
See "Stash: Using branch permissions".

https://confluence.atlassian.com/download/attachments/313460915/STASH310_branch_permissions.png?version=1&modificationDate=1433809165549&api=v2

By limiting write access to a specific owner, for instance, you remove push for all other contributors.

like image 145
VonC Avatar answered Dec 24 '25 10:12

VonC


Technically, you could set up a hook that forbids pushing to a certain branch. This is discussed in Is there a way to lock a branch in GIT.

However, your statement

what we need to do is we need to freeze our branch after the release

makes me think that you actually want to use git tag instead of making a branch read-only.

like image 35
eckes Avatar answered Dec 24 '25 11:12

eckes



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!