开发者

How do I set the permissions so all users can read and write my repository?

开发者 https://www.devze.com 2023-01-29 21:08 出处:网络
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:

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:

开发者_如何学JAVA
git 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号