A way to restrict Git branch access?

后端 未结 9 551
天命终不由人
天命终不由人 2020-11-27 16:34

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

  • Production
  • Staging
  • Master
  • [person\'s name]-development
相关标签:
9条回答
  • 2020-11-27 17:06

    Not practically. Git branches aren't really distinct from one another in the way that you're probably thinking they are.

    What you probably want to do here is use a separate repository for each user's development branch.

    0 讨论(0)
  • 2020-11-27 17:08

    As with GitLab, so does BitBucket.org have a branch restriction feature.

    http://blog.bitbucket.org/2013/09/16/take-control-with-branch-restrictions/

    0 讨论(0)
  • 2020-11-27 17:10

    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.

    0 讨论(0)
提交回复
热议问题