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 biz开发者_运维问答arre -- what am I missing here?
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.
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.
精彩评论