Tags

I run a git server on WebFaction. Their standard application installer only provides permissions at the app level, so breaking out permissions for contractors versus employees is somewhat of a pain. Some people have had luck installing gitosis to manage this, but given the instructions I’ve seen, it requires a bit more time and attention than I have right now. WebFaction themselves suggest setting up a separate git application, but how do you link the two repositories to stay in sync? Well, git being a distributed VCS, it’s actually pretty easy.

Basically all you need is a secondary repository cloned from the master. The trick is to make this a bare repository. Then just add a post-receive hook to push and off you go. Clearly there are my caveats for this approach, but from a quick and dirty perspective, you can’t beat it.

cd $SECONDARY_REPO/repos
git clone --bare $PRIMARY_REPO/repos/$REPO_NAME.git
cd $REPO_NAME<tt>
git config http.receivepack true</tt>
echo "#!/bin/bash
git push origin master" &gt; hooks/post-receive

With this setup it’s possible to create separate permissions on the two repositories while keeping them linked.