A PHP Developer's Blog - Joakim Nygård

About jokke.dk

jokke.dk is the personal website of , a software architect, entrepeneur and Mac user living in Copenhagen, Denmark.

Search the Site

Recent Posts

Popular Posts

Setting Up A Shared Git Repository

25th October, 2010

There's been much talk about the distributed version control system git, in great part thanks to github. At the office, we put almost everything under version control (either explicit or implicit through Google docs). It just makes sense when more people are working on the same files. Git caught our attention because it's fast, easy to set up and handles branching much better.

To make git work for us, we need it to work a little bit more like svn than it usually does. Specifically we want a central, shared repository on a server to commit our individual changes to. It turns out this is very easy to do:

  1. Initialize a new repository on the server. This will create a bare repository (not a checkout) shared between users of the same group. We added ourselves to a new developers group.

    git init --bare --shared=group projectname.git

  2. Make sure the group is correct so all developers have access. Replace $group with your group name.

    chgrp -R $group projectname.git

  3. After cloning the repository and making a few changes, pushing the changes to the shared repository:

    git push origin master

This is only needed the first time. After that a git push is enough, as long as there is only one branch.

« Analog Compression  –  Facebook Social Inbox »