How to write a git hook to limit writing to a branch?

I would like to restrict write access to the lead branch to only a few developers, allowing others to pull everything out and click on other non-master branches. The idea is that the developer will advance to some other branch, and then, if the code passes the check, the reviewer will merge it into a leading branch.

I'm sure this can be easily done with git commit hook, but I don't know python, and it seems like such a general problem that someone should have written it already. Do you know where I can find such a script? Or, if you have someone lying nearby, paste it here for lazy people like me.

+3
git python permissions hook restrict
Nov 06 '10 at 18:11
source share
2 answers

I think it would be possible to use such a script, but this is not a suitable place for rights management, it should be executed on the git server side. For example, in gitosis, you do this configuration in the gitosis-admin repository in the gitosis.conf file.

Crochet-controlled security can be easily broken, only the server can track this situation, please check the documentation on your server to find out how to restrict access.

+4
Nov 06 '10 at 19:10
source share

For your requirement: "if the code passes the review, the reviewer will merge it into the main branch."
You can try Gerrit Code Review: http://code.google.com/p/gerrit/

+3
Oct 23 '12 at 6:23
source share



All Articles