具有不同文件权限的git克隆

发布于 2024-09-14 17:54:27 字数 383 浏览 1 评论 0原文

在我们的服务器上,三个(实际上:数千个)文本文件存储在裸 git 存储库中:A.txt、B.txt、C.txt。

  • 用户“admin”应该查看/编辑它们。
  • 用户“Foo”应该查看/编辑“A.txt”和“B.txt”,但不允许他查看“C.txt”的内容。
  • 仅允许用户“guest”查看/编辑“A.txt”。

所有三个用户都应该能够使用他们的文件克隆 git 存储库 被允许编辑。

有没有可能用 git (...或 Mercurial)来做到这一点?

想法:我可以使用稀疏结帐来克隆裸 git 存储库吗 git 为用户“Foo”和“guest”提供的功能,仅包含他们的文件 被允许看吗?

还有其他(更快)的想法吗?

On our server are three (in reality: thousands of) text files stored in a bare git repository: A.txt, B.txt, C.txt.

  • User "admin" should view/edit them all.
  • User "Foo" should view/edit "A.txt" and "B.txt" but he is not allowed to see the content of "C.txt".
  • User "guest" should only be allowed to view/edit "A.txt".

All three users should be able to clone the git repository with the files they
are allowed to edit.

Is there any possibility to make this with git (...or mercurial)?

Idea: Can I make two clones of the bare git repository with the sparse checkout
feature of git for the user "Foo" and "guest" wich include only the files they
are allowed to see?

Any other (faster) idea?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

你与昨日 2024-09-21 17:54:27

你应该:

  • 拥有三个分支机构
    • 访客(仅包含 A.txt 文件)
    • 用户(具有 A 和 B.txt 文件)
    • 管理(包含所有文件)

这意味着频繁合并以更新不同的分支并传播不同的修改。

另外,使用 gitolite,您可以控制谁可以拉/推什么(在分支级别),这意味着:

  • 访客只能拉动 guest 分支。
  • foo 用户只能拉取 guest 分支和 users 分支,同时能够推送 users 分支(或两个分支)如果您希望用户更新 guest 分支的内容)。
  • 管理员可以拉/拉所有分支。

You should:

  • have three branches
    • guest (with only A.txt files)
    • users (with A and B.txt files)
    • admin (with all files)

That means frequent merges to update the different branches and propagate the different modification.

Plus, with gitolite, you can control who can pull/push what (at a branch level), which means:

  • a guest will only be able to pull the guest branch.
  • a foo user will only be able to pull the guest branch and the users branch, while being able to push the users branch (or both branches if you want a user to update the content of guest branch).
  • an admin can pull/pull all branches.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文