Reputation: 6285
Is there a way to lock the Git branch for writing AND reading? So that no writing to the branch and no cloning from the branch will be possible, but just for one person who is build engineer?
Here is the scenario:
The code has been pushed to the Git repository and then the development branch was made. Now the idea is to lock the master branch for everybody, but one person and have devs to clone from the development branch and push the code back to the development branch.
Only one person - build engineer should have access to the master branch.
Also, is there a good Gui tool that can work with Git? We currently use SourceTree, but it displaying the tree and commits is ugly.
Thank you.
Upvotes: 3
Views: 6633
Reputation: 1329662
Git works at the repository level, which means if you can clone a git repo, you can clone it completely (with all its branch)
That means read access cannot be enforced below the repo level (for a branch).
The all repo can be made private, but that is not a feature from git, more a listener managing access in front of the git repo (like an Apache server or and ssh daemon coupled with user authentication and authorization).
To achieve complete read protection, you would need two repos:
Developers would still have access to master through the original repo that was forked though.
For a complete isolation, you would need to make the first repo a private one, and the second would no longer be a fork.
But more generally, having (read) access to master is not a bad practice:
development
branch is blocked, that means a rebase of said development
branch is not possible: any development goes on on that branch (and not master
)Upvotes: 3