views:

31

answers:

1

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?

+1  A: 

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.
VonC