Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git branch permissions

Tags:

git

branch

Is it possible to set branch permissions using git bash? I would like to have much more strict permissions on the master branch, so that some people can use the development branch and commit to it and may not change the master branch themselves.

If it is possible how would I go about trying to do it?

like image 769
MikeyJ Avatar asked Nov 06 '12 09:11

MikeyJ


People also ask

How do I set permissions on a branch?

Step1: Navigate to the branch permission and press F12 to open the NetWork tool. Then you could select the network tab. Step2: Try to change the permssion. Step3: You could check the network record and get these parameters.

Can we give branch level access in GitHub?

You can only give push access to a protected branch, or give permission to create a matching branch, to users, teams, or installed GitHub Apps with write access to a repository. People and apps with admin permissions to a repository are always able to push to a protected branch or create a matching branch.


2 Answers

Git does not have branch specific permissions. You can either make the whole repository read only to the people or create one private and one public repository and only push the development branch to the public on while keeping the master only in your private repository.

Edit: For branch specific permissions, you need a server-side authorization layer like Gitolite — obviously, this requires you to be managing your own Git server.

like image 140
Trudbert Avatar answered Oct 04 '22 18:10

Trudbert


A typical scenario where this might be needed is to restrict access to official (or release) branches to a subset of people on a team. A good strategy here might be to have two repos -- a primary repo that is more tightly access controlled, and another repo that everybody in the team has access to and is used to setup working branches. And perform pull from the working branches to the main repo, as needed. Of course, you can tweak this to fit your team structure and needs.

This can work especially well with services like github.

like image 34
Shyam Habarakada Avatar answered Oct 04 '22 18:10

Shyam Habarakada