git - GitHub - prevent collaborators from using push -f -
is there way prevent force push branch or repository?
i want stop important branches having history rewritten either accidentally or intentionally. how people deal in larger development teams?
ideally, in view, possible lock few branches per repository, , prevent everyone, other repository owner doing force push them.
this easy git pre-receive
hook. of course, requires able install hooks, , obvious reasons, github doesn't allow upload arbitrary executable files run on servers :-)
in general, workflow git or distributed version control system, don't allow other people push repository. instead, pull theirs. requires lower level of trust. so, workaround number 1: don't let them push, have them fork , pull them. way, can control goes repository.
another workaround set own staging repository on server own, can install own git hooks. can configure pre-receive
hook denies pushing if it's not fast-forward , post-receive
hook automatically forwards pushes github. of course, means lose many of benefits of using github in first place.
as third workaround, use multiple repositories. combination of 2 other approaches: have 1 repository collaborators can push , 1 have access to, pull first repository.
at rate, should file feature request github (especially if paying customer!) since seems useful feature.
Comments
Post a Comment