Search code examples
gitgerrit

Gerrit Project Branch Permission


My Gerrit Version is -2.10.2

I have one gerrit project in that I have two branches Master and Release_Branch in this I want to restrict the branch permissions, Means Master branch should not be accessed by Release_Branch team members. Similarly Release_Branch should not be accessed by Master branch users.

For the same I have created two groups in gerrit and created the access like below,

Reference: refs/heads/Release_Branch/*

Permissions Settings:

Read - Release_branch_Group
Create Reference - Release_branch_Group
Push - Release_branch_Group
Push Merge Commit - Release_branch_Group
Label Code-Review - Release_branch_Group
Submit - Release_branch_Group

Still when we tried to clone the (Release_Branch) from user’s machine with below command, it shows below error.

git clone --single-branch -b Release_Branch ssh://ramesh.s@ss-gerrit-server:29418/test

Error:

Cloning into 'test'...
warning: Could not find remote branch Release_Branch to clone.
fatal: could not fetch refs from ssh://ramesh.s@ss-gerrit-server:29418/test

Could someone assist me to fix the same?


Solution

  • If your branch is named "Release_Branch" then you need to change:

    Reference: refs/heads/Release_Branch/*
    

    To:

    Reference: refs/heads/Release_Branch
    

    The first one grant permissions to branches like "Release_Branch/foo" or "Release_Branch/boo".