I want to setup a git repository (bare repo) where only people from the "development" group can read/write from the repository. How can I do this? (I would prefer to do this over http)
I am running Mac OS X 10.6 Server
Server Fault is a question and answer site for system and network administrators. It only takes a minute to sign up.Sign up to join this community
You can set up an Apache server and WebDAV on the server to authenticate your users.
I've done this with subversion, but it looks like it works similarly for Git.
You have several options for restricting who can write to a git repository:
1) In your webserver configuration, you could restrict access to the repository based upon group membership or user ID. This would be an Apache configuration, for example in the AuthGroupFile setting http://httpd.apache.org/docs/current/mod/mod_authz_groupfile.html#authgroupfile and http://httpd.apache.org/docs/2.2/mod/mod_auth_basic.html#authbasicprovider (but you may then need to map from /etc/group to this file format).
2) Simpler, you could manage the repository permissions through the filesystem. In your .git directory, you can
chmod -r a-rw and
chmod -r g+srw to restrict reading and writing from the directory to members in the specified unix group (let me know if you need more precise instructions here).
git-init has a
--shared=group switch that will allow access to multiple users based on unix group (cf. http://kernel.org/pub/software/scm/git/docs/git-init.html)
3) check out Gitosis (http://scie.nti.st/2007/11/14/hosting-git-repositories-the-easy-and-secure-way) which is a straightforward Git repository "server" that centralizes authentication and ensures you don't need separate Unix users for each Git user (and/or to group them separately). As with #1, you will trade off operational simplicity for setup complexity (because you may now be managing two group lists).
Hope that helps.