I’m trying to use git in a way that keeps some subdirectories in a project secret/hidden from “untrusted” users, but visible to other “trusted” users. Note that this is not just write protection; the untrusted users can’t be allowed to read the secret files either. I’d like the user experience to be as if it was a single git repo, rather than something like submodules.
I’ll tell you my only idea so far, in case that spurs some discussion or criticism. I’m considering having two parallel repos behind the scenes on the server. Trusted users clone/pull/push the trusted repo. Untrusted users clone/pull/push the untrusted repo. When a commit is made to the trusted repo, it is filtered to remove secret content before being applied to the untrusted repo. Going the other direction, commits to the untrusted repo are filtered to avoid clobbering secret content before being applied to the trusted repo.
How should I accomplish this goal?
Is my proposed solution crazy?
That is probably technically possible, assuming you plan to hack
gititself. A few questions you’ll need to answer:If you hack git, all things are possible.