git - 为某些用户锁定主分支? [英] git -- locking master branch for some users?

查看:191
本文介绍了git - 为某些用户锁定主分支?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想迫使其他团队成员不能在主分支上工作,而是在开发分支上工作。我们有一个中央git-repository,在这里我们推动我们的工作。我想知道是否有可能阻止用户将更改推送到主分支,但只允许某些用户这样做。



我想要有以下工作流程


  • 开发始终只能用开发分支完成

  • 发布管理员负责主分支,只允许他将开发分支中的东西合并到主分支中,并将其推送给主分支,分支到中央存储库。



这是可能的,我该如何做到这一点?

解决方案

请参阅 man你可以创建一个 $(git rev-parse --git-dir)/ hooks / pre-receive $ c>或 $(git rev-parse --git-dir)/ hooks / update 脚本验证您的用户试图推送哪些文件。 Git附带了 update-paranoid 示例挂钩强制执行每个ACL。


I would like to force other team-members to not work on the master-branch but on a development branch. we have a central git-repository where we push our work into. i would like to know if it's possible to block users from pushing changes to the master-branch but only allow certain users to do so.

I would like to have the following "workflow"

  • development is always only done with a development-branch
  • the release-manager is responsible for the master branch and only he is allowed to merge stuff from a development branch into the master and push it to the master-branch on the central repository to.

Is this possible and how can I achieve this?

解决方案

See man githooks: In the shared repo, you can create a $(git rev-parse --git-dir)/hooks/pre-receive or $(git rev-parse --git-dir)/hooks/update script that verifies what your users are trying to push to which refs. Git comes with a update-paranoid example hook enforcing per-ref ACLs.

这篇关于git - 为某些用户锁定主分支?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆