如何设置不同的用户只能看到某些部分的git存储库? [英] How to setup a git repository where different users can only see certain parts?

查看:203
本文介绍了如何设置不同的用户只能看到某些部分的git存储库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你如何设置一个git仓库,其中一些用户可以看到源代码的某些部分,其他用户可以看到所有这些?我已经看到很多指导,只给予某些用户提交访问权限,但是这些假设每个人都应该具有读取权限。我也听说过gitosis,但我不确定它是否支持这个功能,并且它在一年内没有任何提交,所以我认为它已经死了。

How do you setup a git repository where some users can see certain parts of the source code and other users can see all of it? I've seen lots of guides for only giving certain users commit access, but these assume everyone should have read access. I've also heard of gitosis, but I'm not sure it supports this and it hasn't had any commits in over a year so I think it's dead.

推荐答案

总之:你不能。 Git是基于快照的(至少在概念级)版本控制系统,而不是基于变更集的。它将项目(存储库)作为一个整体来对待。历史记录是一个项目的历史,而不是单个历史记录的联合(它不仅仅是每个历史记录的联合)。

In short: you can't. Git is snapshot based (at conceptual level at least) version control system, not changeset based one. It treats project (repository) as a whole. The history is a history of a project, not a union of single-file histories (it is more than joining of per-file histories).

使用钩子如 update-paranoid 在contrib中挂钩,或 VREF 机制 gitolite ,您可以允许或禁止访问存储库,您可以允许或禁止访问各个分支机构。你甚至可以禁止任何改变指定子目录中的东西的提交。但是这个项目总是被视为一个整体。

Using hooks like update-paranoid hook in contrib, or VREFs mechanism of gitolite, you can allow or forbid access to repository, you can allow or forbid acces to individual branches. You can even forbid any commits that change things in specified subdirectory. But the project is always treated as a whole.

好的,你可以做一件事:制作一个你想限制访问的目录到 子模块 ,并限制对此子模块存储库的访问。

Well, there is one thing you can do: make a directory you want to restrict access to into submodule, and restrict access to this submodule repository.

这篇关于如何设置不同的用户只能看到某些部分的git存储库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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