Question

I know i can set permissions on GIT to deny users push access to the master branch, but I don't have access to set these permissions.

I still want to disable write access to the master branch for my developers machines. Is there something i can configure on their local machines to let them write to only one branch?

Was it helpful?

Solution

The ideal way would be to install gitolite on the central server, because you can then control those ACL from your workstation (by modifying the special admin repo 'gitolite-admin')

If this isn't possible, then you have to deploy a hook, like a pre-push hook (here is an example) in order to check the remote ref: if it is origin/master, then you can exit with 1 (fail), and that will cancel the push.

But that is a hook that need to be deployed for all the users, which is less convenient than having a centralized access control solution like gitolite.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top