如何限制Git仓库中的文件夹/文件? [英] How to restrict folders / files on a Git repo?

查看:47
本文介绍了如何限制Git仓库中的文件夹/文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Github上,如何限制私人存储库中的某些文件夹或文件?

On Github, how do I restrict some folders or files on a private repo?

我不想让开发人员可以完全访问存储库中的所有内容.

I do not want to give developers full access to everything in a repo.

推荐答案

您不能.

如果您授予某人推送许可,那么他将可以推送他想要的任何内容.

If you give someone the push permission, he will be able to push whatever he want.

如果您希望某人拥有部分访问权限,则有很多选择:

If you want someone to have a partial access, you have many choices:

  • 让他分叉并请求存储库.您可以检查它是否可以满足您的目的
  • 非常清楚,他不应该修改任何其他文件/文件夹,并不时签入提交历史记录.
  • 制作一个接收后钩子,以检查提交修改的内容,作者并基于此拒绝或接受提交.

如果您不希望他具有对其他文件的读取访问权限,那么最好的方法是为他创建一个单独的git存储库,并将其用作您自己的git存储库的子模块.请参阅此处: https://git-scm.com/book/zh/v2/Git-Tools-Submodules

If you don't want him to have read access on other files, then the best way to go is to create a separate git repository for him, and use it as a submodule of your own git repository. See here: https://git-scm.com/book/en/v2/Git-Tools-Submodules

这篇关于如何限制Git仓库中的文件夹/文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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