How to set specific path permissions using Git?

The design of Git does not allow this kind of access-control. You can create separate repos for dir1 and dir2, and give appropriate permissions for each of those repos, but you can't restrict access to single directories inside a Git repo.


If you use gitolite to host your git repository, you can setup fine grained access control for branches, or even files. See: basic access control and advanced access control, path restriction in particular is described here.

Tags:

Git

Github