How do I set the permissions so all users can read and write my repository?
I want to create a git repository and allow all users to have access to it. As per a recommendation in another question, I tried initializing it by:
开发者_如何学JAVAgit init --shared=0777
This allows other users to give a git status
git log
and git branch
. However, if I ever try to commit anything on a branch as another user, this is the error message I get:
fatal: could not open '.git/COMMIT_EDITMSG': Permission denied
Any advice?
I think you are suffering from a kind of SVN syndrome. In git, each user has their own repo which is cloned from the "central" repo and they push and pull from the "central" repo, which, as Philipp points out, should be bare (when you create it, do git --bare init). That repo should be shared, of course, but only so that people can push and pull from it. They should not be making commits in it. In fact, if it is a bare repo, then they are unable to make commits as there is no checked out working tree.
I'd really recommend reading some of the literature on the git website, specifically the sections/chapters about repos and how they relate to each other.
精彩评论