Let's assume that you already setup a user "otheruserid" (maybe you created a "git" user) that is in the same group as the developers that need access to the repository. We'll assume that "userid" is a member of that same group. It is a better idea to create this as a more generic user that won't be removed later, so that the group membership can be dynamic (as people come and go). Note that the .git at the end of the path is optional.
For this next part, don't change group to the group name. It is literally supposed to be this exact line if you want to share with the group. If you want it to be open to the public, you'd specify "all" instead of "group".
sudo su - otheruserid mkdir -p /some/path/nameofmyproject.git chmod 775 /some/path/nameofmyproject.git cd /some/path/nameofmyproject.git
Richard mentioned that if you want to create a private group repository and manage permissions across everything a little better you could use getacl/setacl (even though you should still use --shared=group, just in case). You can probably find more on permissions via a search, but berliOS has a GIT HowTo with a section on How to control access to your GIT Repository just as one example of fine-grained permissions.
git --bare init --shared=group (Ctrl-D twice to get back to your local environment)
Back on your computer, or wherever you want to develop, do the following:
Be careful that you change directory into your new nameofmyproject directory, otherwise you could end up adding everything that is not nailed down (via git) into your new repository!
mkdir -p /path/to/my/projects/dir cd /path/to/my/projects/dir mkdir nameofmyproject
Ok, now you have the local copy, but if you try to do "git pull" it won't work because the following isn't defined in .git/config:
cd nameofmyproject git init git remote add origin userid@yourremoteserver:/some/path/nameofmyproject.git touch .gitignore git add . git commit -m "Initial commit" git push --all
You could edit .git/config to add that to the bottom, or better yet- blow away the local project directory you just created (please back it up first if it is important!) and clone from the remote repo:
[branch "master"] remote = origin merge = refs/heads/master
cd .. rm -rf nameofproject (warning: back it up first, if you are unsure about removing it) git clone ssh://userid@yourremoteserver/some/path/nameofmyproject.git
If someone else wants to clone the repository to work with it locally, they do this:
git clone ssh://userid@yourremoteserver/some/path/nameofmyproject.git