Our co-op uses the git revision control system pretty extensively, both directly and through etckeeper. With more workers, we’re keeping more shared copies of our git repositories. So inevitably, we ran into permissions problems.
Thanks a lot to Moser for pointing out the git repo-config core.sharedRepository true option. I’ve also had a bit more of a look around git config (because repo-config is an alias for that) and wonder about the logAllRefUpdates and whitespace settings.
Anyone have favourite values for these or other cooperative git tips?








9 comments so far
1 MJ Ray (mjray) 's status on Monday, 19-Oct-09 07:14:41 UTC - Identi.ca // Oct 19, 2009 at 7:14 am
[...] Published Sharing git repositories http://www.news.software.coop/sharing-git-repositories/791/ [...]
2 Moser // Oct 19, 2009 at 7:23 am
Shared git repos over ssh is somehow obsolete. Gitosis works better and easier: http://www.perevillega.com/installation-guides/gitosis-git-repository/
3 Simon // Oct 19, 2009 at 8:33 am
The “reference log” is a history of what branch heads were in a particular time period. This is mostly useful if you have lots of non-fast-forward updates (which should be disabled in a shared repository anyway) as being mentioned in a reflog keeps otherwise unreachable objects from being garbage-collected and addressable through the reflog. It is mostly a tool for undoing destructive changes, like rebasing or deleting branches.
The whitespace setting allows you to refuse commits that add whitespace at the end of a line in some file. That is more useful for the working repos than the shared one, as refusing a commit that late will make it necessary for people to rebase (also, I’m not sure this actually works for push/pull only repos).
4 MJ Ray // Oct 19, 2009 at 12:34 pm
gitosis looks fine if we don’t want people to have ssh accounts (which may be the case for some projects), but looks like some duplication and some extra work if all users have ssh accounts. Have I understood that right?
Thanks for the summaries. I’ll look at disabling non-fast-forward updates.
5 inigo // Oct 19, 2009 at 1:00 pm
I don’t use git, but maybe you find usefull to integrate PAM with openldap to manage users/groups. I’ve done that with svn (that also may benefit from ldap using https//).
6 Anonymous // Oct 19, 2009 at 6:08 pm
You don’t want sharedRepository=true, you want sharedRepository=group. Equivalent in current git, but some older versions of git misinterpreted “true”, and servers sometimes have older versions of git (because they run stable/”enterprise” distributions, and because for the most part Git can run just fine with an old server version and a new client version).
7 Jacopo // Oct 20, 2009 at 3:08 am
A good setting for core.autocrlf is a must for Windows-Linux shared repositories. The auto conversion doesn’t always work and you lose the ability to simply copy stuff around.
If your tools can cope with Unix-style line endings (Visual Studio does), I find it much better to shut autocrlf off.
8 Philip Hands // Oct 22, 2009 at 8:19 am
gitosis liberates you from the “do I need to trust this person with a shell account?” moment when suggesting they push to your git, which is nice.
Even better than that is the fact that you replace the admin you’d then have to do on the server (add user, populate authorized_keys, add them to groups, wonder if the unix groups really reflect what you wanted, check it works, perhaps restrict their shell, wonder if you’ve done everything), with:
1) “Joe, send me a mail with an ssh id.pub”
2) cd …/gitosis-admin
3) cut&paste id.pub to keydir/joe_bloggs.pub
4) edit “joe_bloggs” into the relevant group menbers lists in gitosis.conf
5) git commit -m “+joe_blogs” keydir/joe_bloggs.pub gitosis.conf
6) git push
and you’re done (all from your laptop
Cheers, Phil.
9 Bogdan // Nov 1, 2009 at 4:32 pm
I have been using gitosis for over a year now, and it is indeed a useful piece of software (I’m hosting ~6 projects using gitosis). However, I am not familiar with “shared repository” concept (unless that is just a repository with access allowed to someone else – other than yourself).
Does someone have experience sharing the same git repository between Linux and Windows? e.g. I have a /mnt/d/ NTFS partition, which has my “project” git repository; I also have msys-git installed under windows, which accesses that repository at D:\projects\. The problem is that while “git pull; git status” under linux shows no changes to commit, reboot into windows and “git status” shows quite a number of “modified” files.
I haven’t yet had courage to do “git reset –hard” in windows to see if that fixes the problem (the repository is too large to restore over the network).
Any suggestions are welcome (I’m subscribed to followup comments).