有没有一种很好的方法来限制每个分支在git上的读取(提取)?

编程入门 行业动态 更新时间:2024-10-15 00:19:53
本文介绍了有没有一种很好的方法来限制每个分支在git上的读取(提取)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我很乐于使用围绕git的工具和策略。本质上,我们希望将存储库中的分支的子集公开到一组用户的读取或读取/写入。另一个分支子集甚至不会被这些用户知道。使用两个独立的存储库,一个公用的私人存储库,don不要将私人分支推送到公共存储库。

您可以使用 update hook 在公共存储库中拒绝尝试推送这些私人分支的推送,以避免意外推送私人分支到公共存储库。你也可以使用 pre-receive 钩子,如果你想阻止整个推送,如果有人不小心尝试推送一个私有分支,而不是阻止该分支的创建。

您也可以简单地使用公共存储库中的示例 update 钩子(将其重命名为 update.sample 到 update ,并确保它是可执行的),并设置 hooks.denycreatebranch 配置设置拒绝创建公共回购协议中的任何新分支,只允许它包含已经存在的分支或在该回购协议中本地创建的分支。

I am open to using tools and strategies around git. Essentially, we want to expose a subset of the branches on a repository to Read or Read/Write for a set of users. Another subset of branches would not even be known to those users.

解决方案

Use two separate repositories, one public one private, and don't push the private branches to the public repository.

You could use a update hook in the public repository to deny pushes that try to push those private branches, in order to avoid accidentally pushing the private branches to the public repository. You could also use a pre-receive hook if you want to block the entire push if someone accidentally tries to push a private branch, instead of just blocking the creation of that branch.

You could also simply use the sample update hook in the public repository (rename it from update.sample to update, and ensure that it is executable), and set the hooks.denycreatebranch configuration setting to deny creation of any new branches in the public repo, only allowing it to contain branches that already exist or which are created locally in that repo.

更多推荐

有没有一种很好的方法来限制每个分支在git上的读取(提取)?

本文发布于:2023-11-23 18:55:42,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1622523.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:很好   方法来   分支   git

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!