Create a Git view like in SQL

1

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.

mlaug

Posted 2012-03-09T11:00:45.007

Reputation: 193

Answers

2

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

sleske

Posted 2012-03-09T11:00:45.007

Reputation: 19 887