'Github Enterprise - give read permissions only for a specific file in a repo

I am using Github Enterprise and would like to give other teams access to my repository. However I don't want those teams to see the repository content, I want them to be able to see ONLY a specific file or a subdirectory (and its content).

Is that possible ?



Solution 1:[1]

You'll find documentation on access permissions here. The access permission model is different for repositories owned by user accounts versus those owned by organization accounts. However, in neither of those models is there a provision for providing read access to only a part of a repository. Read permission grants read access to the entire repository.

There are probably a number of creative ways to achieve the effect you're after. One would be to set up an automated process that clones your first repository, copies the files or subdirectory of interest to a second local repository, and then pushes any changes in that second repository back to GitHub Enterprise. You'd provide your other teams read access to that second repository, but not the first.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 David Mittman