Search code examples
gitrepositorycollaboration

Git push randomly fails


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?


Solution

  • 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.