Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Is it possible to create a view of a Git repository just like in SQL? I would like to give someone access to a repo, but just on a certain file types such as CSS; however, I want to deny access to PHP and JavaScript files.

share|improve this question

1 Answer 1

up vote 2 down vote accepted

This is (partially) answered in this question: Git: Access Control? How to do in practice:

You cannot control by branches or whatever. Git downloads the entire repo. Period.

This (always downloading the entire repo) is a fundamental design decision in git, no way around this.

If you just want to provide read access, you could use some different system, e.g. have some regular job that mirrors file to e.g. a web server, where they can be viewed & downloaded.

If you want to provide write access, but still restrict read access to other parts, there's probably no way around splitting the repo (or implementing some complex synchronization scheme involving multiple repos and pushing & pulling).

If you want to restrict write access, but don't mind giving read access to everything, you could use git hooks. You might also want to consider gitolite:

Gitolite is an access control layer on top of git. Here's an "executive summary":

[...]

control access to many git repositories

read access controlled at the repo level

write access controlled at the branch/tag/file/directory level

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.