0

i have folder structure as below :

repo1
|
|---file1
|---fold1
    |
    |---file2
|---repo2
    |
    |
    |---file3

Lets say i have two users, user1 and user2.

Now i need to :

  1. setup repo1 and repo2 as two separate GIT repositories.
  2. setup user1 to have permission for repo1 and user2 for repo2.
  3. user1 should be able to pull file1 and fold1 contents but not repo2
  4. user2 should be able to pull repo2 and files under it but not repo1
  5. after user2 makes changes and commits to repo2, it should be reflected under repo1 in the server

Is this level of permissions possible with GIT?

rdm_
  • 67
  • 1
  • 8
  • This seems very unusual - what are you trying to do? – 1615903 May 24 '16 at 05:05
  • @1615903 i have existing project with above folder structure, we are setting up GIT repository for that project , so i want certain users to access only a subfolder inside main folder while some users should have access to only the main fodler. – rdm_ May 24 '16 at 05:50
  • that much I understood from the question, but I'm wondering why. Why can't user1 have access to repo2's content? Submodules would be a suitable option if you can give user1 at least a read access to repo2. – 1615903 May 24 '16 at 05:54
  • @1615903 user1 should not have access to repo2 because files inside that are app specific only that app owner should be able to see and edit them.user2 is app specific and he should not be able to see ops contents. – rdm_ May 24 '16 at 07:09

1 Answers1

2

see 'git submodule'.

  • passwords and permissions on the server repo's can be set in the server

  • each user would have to have their own local repositories.

  • repo1 would be main module, repo2 would be the sub module. see.

    git help submodule

  • if user2 pushed (from local to server, after committing) to repo2, user1 would pull the changes with a 'git submodule update' command, but not automatially.

Gregg
  • 2,444
  • 1
  • 12
  • 21
  • thanks @gregg i read that `git subtree` better than `git submodule` so i followed this post [ http://stackoverflow.com/questions/359424/detach-subdirectory-into-separate-git-repository/17864475#17864475 ] but after i separate out a subdirectory as a repository , im not sure how to merge it back and view in the parent directory. – rdm_ May 24 '16 at 05:21