Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In a single directory with a Git root folder, I have a bunch of files. I am working on one of those files,, with my friend Alice. The other files I am working on with other people. I want Alice (and everyone else) to have access to I want Alice to only have access to though.

How can I achieve this with Git? Is there a way I can split a directory into two repos? That sounds rather cumbersome. Maybe I could add a remote repo that Alice can access containing

share|improve this question
Don't share the repository. Instead, have Alice send you updates / patches as needed. – parsifal Mar 26 '13 at 21:08
@parsifal You should add that as an answer – kyrias Mar 31 '13 at 15:36

If it was SVN you could easily handle this with permissions, but most DCVSes don't have that fine-grained permissions as that is completely unworkable with everyone having a copy of the repository.

Probably the best way to handle this would be to have alice fork the repository and submit pull requests -- you could then make sure she is just working in and not anything else.

If you don't want her reading anything else then you'd need to work with subrepos. But as a great man once said "when you've got a problem and you say 'hey, I'll use subrepositories' then you've got two problems."

share|improve this answer

You make a branch X and delete everything except and the push the branch to a central repository. If you want to share also, you add it to your branch and you merge this branch with X from the central repository.

You don't push to the central repository anything that you don't want to be seen by others.

share|improve this answer
Unfortunately, if you want the remote branch to be mergeable, it must contain all the history from before you deleted the other files. – Karl Bielefeldt Mar 26 '13 at 23:45

Your Answer


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.