一种限制Git分支访问的方法? [英] A way to restrict Git branch access?

查看:125
本文介绍了一种限制Git分支访问的方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的git仓库中有四个分支,它使用GitHub进行管理: li>分期付款
  • 主人

  • [人名] - 开发

  • $ b

    有没有办法限制只有一个分支([人名] - 开发)的写入权限?我将如何做到这一点?

    仅供参考,类似的问题:如何编写一个git钩子来限制写入分支?

    解决方案

    使用GitHub时,最佳选择是让每个开发人员拥有自己的主存储库分支。每个人都会推送他们自己的存储库,并且有人通过对主存储库的推送访问来处理每个开发人员的存储库。这是大多数开源项目的工作原理。



    如果使用自己的Git服务器,应该可以使用钩子来防止用户推送错误的分支。


    I have four branches in my git repository, which is managed using GitHub:

    • Production
    • Staging
    • Master
    • [person's name]-development

    Is there a way to restrict write access to only a single branch ([person's name]-development)? How would I do this?

    For reference, a similar question: How to write a git hook to restrict writing to branch?.

    解决方案

    When using GitHub, your best option would be for each developer to have their own fork of the master repository. Everybody pushes to their own repository and somebody with push access to the master repository handles pulling from each developer's repository. This is how most open source projects work.

    If using your own Git server, it should be possible to use hooks to prevent users from pushing to wrong branches.

    这篇关于一种限制Git分支访问的方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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