tags:

views:

19

answers:

1

Hi all. I have this problem when i try to push in git:

error: insufficient permission for adding an object to repository database ./objects

fatal: failed to write object
error: unpack failed: unpack-objects abnormal exit
To ssh://<repo url>/<repo dir>
 ! [remote rejected] master -> master (n/a (unpacker error))
error: failed to push some refs to 'ssh://<repo url>/<repo dir>'

I've had this before sporadically and we've always had to solve it by each user sshing to the repo and setting group permissions on all the files therein with

chmod -R g+w *

This was never a satisfactory solution and now it's bitten us in the arse as one of the guys is away and no-one knows his repo user's password. So, i'm trying to solve it properly.

The error seems to occur when someone tries to push up a change that will alter a repo dir that is owned by another user (hence setting the group write option above). I've done a bit of googling around this and have found a couple of solutions being discussed (neither of which worked for me)

1) make sure that the group that the repo dirs are shared with is each users' primary group (i believe that is the case already: each user has only one group so that must be their primary group, right?)

2) git repo core.sharedRepository setting, as detailed here: http://stackoverflow.com/questions/398203/git-cant-push-from-one-computer#answer-399133 I changed this but it didn't make any difference. Do i need to reload the config or something to actually effect the change?

Here's what my repo config looks like atm:

[core]
        repositoryformatversion = 0
        filemode = true
        bare = true
        sharedRepository = all
[receive]
        denyNonFastForwards = True

Grateful for any advice or suggestions! max

+1  A: 

I use gitosis for managing this kind of stuff. Gitosis has a single user (usually called "git") that owns all the repositories, and it uses public-key-based access control to each repo. It might not suit your setup but is probably worth checking out (no pun intended).

Cameron Skinner
There's also gitolite (http://github.com/sitaramc/gitolite), which is kind of an updated and improved version of gitosis.
ebneter
Thanks guys. But do i need to rebuild my repo from scratch using gitosis/gitolite?
Max Williams
No. Just push your existing head into the gitosis repo, or copy your repo directory into the one created by gitosis.
Cameron Skinner