github 是否允许预接收钩子? [英] Does github allow pre-receive hooks?

查看:32
本文介绍了github 是否允许预接收钩子?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

GitHub 是否允许预接收或更新挂钩?

Does GitHub allow for pre-receive or update hooks?

我想要做的是防止主分支被推送到(即 master、hotfix、develop),并要求通过 GitHub 拉取请求合并它们.这是一个私人仓库,所以 GitHub 风格的分叉不是一种选择.

What I would be looking to do is to prevent the primary branches from being pushed to (i.e. master, hotfix, develop) and require that they be merged via a GitHub pull request. This is a private repo so GitHub style forking is not an option.

任何关于如何实现这一点的建议都会有很大帮助.

Any advice on how to accomplish this would be of great help.

推荐答案

只有您列出了合作者"的人才能推送到 Github 托管的存储库.请参阅存储库的管理"页面以添加协作者.其他所有人都需要提交拉取请求"才能让存储库管理员接受他们的添加.请参阅 Github 访问权限.(没有每个分支的访问权限.)所以,为了实现你的目标,你不需要钩子;你需要的已经内置了.

Only people that you have listed a 'collaborators' can push to a Github hosted repository. See the repository's 'admin' page to add collaborators. Everybody else needs to submit a 'pull request' to get their additions accepted by the repository's administrator. See Github Access Permissions. (There aren't per-branch access permissions.) So, in order to accomplish your goal, you don't need hooks; what you need is already built in.

两个注意事项:

  1. 私有 Github 存储库可以有多个贡献者
  2. 鉴于钩子包含任意代码,Github 支持预接收钩子(或任何其他服务器钩子)是不寻常的.

这篇关于github 是否允许预接收钩子?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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