3

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?

AlBlue
  • 23,254
  • 14
  • 71
  • 91
Lasitha Benaragama
  • 2,201
  • 2
  • 27
  • 43

2 Answers2

4

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.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
1

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.

Community
  • 1
  • 1
eckes
  • 64,417
  • 29
  • 168
  • 201