Wednesday, May 27, 2009

Creating a Remote Shared Git Repository

When creating a remote shared Git repository you likely want to do it like this:

ssh gitserver.com
mkdir -p /var/data/repos/myrepo.git
cd /var/data/repos/myrepo.git
git --bare init --shared=group
view raw gistfile1.sh hosted with ❤ by GitHub


The "--shared=group" is important as it will ensure that permissions will be set correctly when working with the repository with multiple users. When issued in this way the config file will end up looking like this:

[core]
repositoryformatversion = 0
filemode = true
bare = true
sharedrepository = 1
[receive]
denyNonFastforwards = true
view raw gistfile1.ini hosted with ❤ by GitHub