github-启用分支锁定 [英] github - enable branch lock

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

问题描述

作为GitHub管理员,我想为所有用户锁定GitHub中的特定分支. 例如如果我不希望任何人推送到Master/Production或Project分支,该怎么做.

没有使用任何客户端挂钩,有没有办法直接在GitHub服务器上锁定分支?是否有任何第三方工具/API/脚本可以帮助实现这一目标?

解决方案

@Saurabh,根据您在GitHub上的要求,我也做了类似的事情:

  • 导航到设置
  • 导航到分支
  • 点击分支保护规则"附近的添加规则
  • 勾选在合并之前需要拉取请求评论复选框

这些步骤将锁定,例如锁定到master,这样,任何协作者都无法将代码推送到该分支.只能使用拉取请求合并代码.

链接到文档

屏幕截图:

注意:Pro,Team和Enterprise用户可以使用受保护的分支机构

As a GitHub administrator, I would like to lock a particular branch in GitHub for all users. For e.g. if I do not want anyone to push to Master/Production or a Project branch, how can I do that.

Instead of using any client side hooks, is there a way to lock a branch on GitHub server directly ? Are there any third party tools/api's/scripts which can help achieve this ?

解决方案

@Saurabh, I have done a similar thing according to your requirement on GitHub:

  • Navigate to Settings
  • Navigate to Branches
  • Tap on Add Rule near "Branch protection rules"
  • Tick the Require pull request reviews before merging checkbox

These steps apply a lock on, for example to master, so that no collaborators can push code to this branch. Code only be merged using pull requests.

Link to documentation

Screenshots:

Note: Protected branches are available to Pro, Team, and Enterprise users

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

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