tags:

views:

46

answers:

2

I'm coding with two other friends and we're all using the same repository. For some reason, git randomly fails for me, and only me.

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

What's intriguing is that we noticed that when friend A pushes his code, I don't get this error anymore, and I can happily push my code as well. Now when friend B pushes his code, all of a sudden, I see this error again.

This is extremely bizarre -- what am I missing here?

+3  A: 

Possible ideas:

  • Your git repository is not configured as shared.

  • Your directory permissions are not quite right, and depending on who creates what subdirectory of .git/objects, you may or may not have write permission. (This problem can be especially acute if your file server is configured not to honor group sticky bits on directories. I got bitten by this one and it still stings. As far as I know, if your server is configured this way, it's not possible for multiple users in different groups to push to a single git repo.)

It would be especially useful to know on which OS and filesystem your repo is stored and how the permissions are set up.

Norman Ramsey
Interesting thoughts, we're running on an Ubuntu server, I'm going to fix up the groups real quick -- I had seen that earlier (the fact that object's are owned by the user and the user group) -- didn't put it all together. Will let you know.
Michael
So far, this is looking promising (though we need to wait for our third coder to come back to be for sure)
Michael
Fantastic! ! ! !
Michael
A: 

To expand on something Norman Ramsey said, about configuring your repository as shared: to do this, go to the repo and run git config core.sharedRepository true. This will tell git to make files that it creates in the repository group writable; after doing this, you should also run sudo chmod -R g+w . to make sure existing files are set group writable as well. Of course, all users who are using the repository will have to belong to the group that owns the files in order for this to work.

mkarasek