I'd like to give a designer commit access to the html/css/images etc for a project I'm working on. The problem is the git repository which stores this information is also shared with the general code base which I'd prefer the designer not have access to as they have no need for it.

In SVN I'd resolve this by simply permissioning directories within the repository to be accessible by certain people only. As far as I'm aware this isn't possible in git due to the different structure, you either have the entire repo or you don't.

What's the recommended way to complete this? How are others getting around this problem?



Either learn to live with the designer having access to the code (they can't change anything without leaving a record of it, anyway), or else split out the stuff they do need access to into a separate repo and then include that in your main project as a submodule. You can use git filter-branch to strip out the parts of the repository you don't want the designer to have access to in the separate repo.

  • Not ideal, but I think I'll have to go with submodules. Wasn't aware of filter-branch, that should help ease the pain - thanks! – Adam Gibbins Dec 24 '09 at 0:53

Git doesn't work that way.

If you want to restrict read-access to the tree, then your only option is to split the stuff you do want him/her to have access to, off into a seperate repository.

If they question is about commit-access/write-access, ask the designer to clone your git repository, make his changes and commit them in the cloned repository. And publish this cloned repository somewhere for you to pull from.

GitHub is excellent for this type of stuff.

You can then pull his changes when you need them, inspect them, test them and merge them into mainline.


According to Pro Git, you can use Enforce a User-Based ACL System to allow only certain users to modify certain subdirectories in a project.

From the article :

In this case, you have a couple of administrators, some documentation writers with access to the doc directory, and one developer who only has access to the lib and tests directories, and your ACL file looks like this

  • 1
    Only if the intent is to only stop attempts to write to the repo; as I understand the question part of the intent is to stop the designer reading the code, too. – womble Dec 23 '09 at 0:00

Have you looked at Gitosis? I'm not certain it will do exactly what you want, but it's designed to control access to git repositories. I'm not sure if it will be granular enough for you, though.

  • Unfortunately gitosis is per repository restrictions, its either access or no access - theres no per directory permissioning (as git doesn't have this ability) so doesn't help my in this situation. Thanks for the suggestion though, gitosis is very nice and I'm using it currently. – Adam Gibbins Dec 23 '09 at 23:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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