如何在不同用户只能看到某些部分的地方建立git存储库? [英] How to set up a git repository where different users can only see certain parts?

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

问题描述

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

How do you set up 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 挂钩,或 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 access 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天全站免登陆