Frage

I have master, staging, prod branches. I would want to restrict anyone merging changes into the remote prod branch alone and would prefer it's handled by a system administrator. How can I place such restrictions in git.

War es hilfreich?

Lösung

git does not have any access control on its own. gitolite provides easy access control on the branch level. It lets you control how can push to which branch.

http://gitolite.com/gitolite/index.html

Andere Tipps

If you want to keep the control over what's pushed on the production branch, you could:

  • Forbid every but the administrator to push to "the company remote repo"
  • Let everyone create a clone of this remote repo, an ensure everyone else can read from those clones
  • Let the developers request a merge request if they want their code to be shipped

The workflow would then be:

  1. A dev make a local clone of the company repo, and works on it
  2. He then create a remote clone, pushes his work on it, and ask a system administrator or merge it
  3. The system administrators are the only one who can push on the the company repo (and in particular on its prod branches). If the merge request is ok for them, they'll push it.

As far as I understand, you could use for example Gerrit or Gitorious to set it up.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top