防止在 GitHub 上推送到 master? [英] Prevent pushing to master on GitHub?

查看:39
本文介绍了防止在 GitHub 上推送到 master?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

GitHub 允许您配置您的存储库,以便 然后,输入您要保护的分支的名称并单击复选框以在合并前要求拉取请求审查.默认情况下,这只会阻止不是版主的人.后面还有另一个复选框,用于确保即使是版主也无法合并.

GitHub allows you to configure your repository so that users can't force push to master, but is there a way to prevent pushing to master entirely? I'm hoping to make it so that the only way of adding to commits to master is through the GitHub pull request UI.

解决方案

Since the original question / answer, Github has added a new option for this to the restricted branches UI which allows you to set this up.

Require pull request reviews before merging When enabled, all commits must be made to a non-protected branch and submitted via a pull request with the required number of approving reviews and no changes requested before it can be merged into a branch that matches this rule.

To find it go to Settings > Branches > Branch Protection Rules and click 'Add Rule'. Then, enter the name of the branch you want to protect and click the checkbox to require pull request reviews before merging. By default, this only stops people who are not moderators. There is also another checkbox later down for ensuring that even moderators cannot merge.

这篇关于防止在 GitHub 上推送到 master?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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