1

I've been looking at How to configure an existing git repo to be shared by a UNIX group but unable to find out what's the problem :

$ git init --shared=group
$ touch test && git add test
$ git commit -m 'test'

Now, if another user commit he gets the message: fatal: could not open '.git/COMMIT_EDITMSG': Permission denied because the file mode is -rw-r----- (however the group is OK).

So of the files in .git/objects/ don't have write permission for the group either

For the rest of it, all directory seems to have been created with the proper shared group and mode.

Do I miss something here ?

martin-h
  • 69
  • 1
  • 8
  • 1
    Have you looked at the commands in the **answer** of the question you linked? – dan1st Dec 08 '20 at 14:17
  • could be an issue with the `umask` : it looks like whoever created that file had a umask set to "don't give group write access" when he/she created that file. The owner of the file is probably the user that ran the `git commit` command that created that file. You would have to select a way to unify the environment settings of everyone interacting with that repo. – LeGEC Dec 08 '20 at 14:48
  • There is a comment in the question you linked, which points to [this answer on ServerFault](https://serverfault.com/a/27040/191742), which does indicate possible issues with umask, and also gives a possible solution using POSIX extended attributes. – LeGEC Dec 08 '20 at 14:54
  • 2
    Your issue, being with `.git/COMMIT_EDITMSG`, seems to indicate the shared repository isn't a bare repo, which would only serve as a common push/pull target. If you are sharing an active repo, beware of all traps that could be triggered when several actions are run (like : `git status` is obsolete as soon as it displays its content, `git commit` may commit files added by another user, etc ...). Unless you have a really good and understood reason why you want to do that, I would strongly suggest to at least take the time to set up a common remote, not a shared working directory. – LeGEC Dec 08 '20 at 14:58

1 Answers1

3

You probably hit an issue with how the umask was set when another user created that file. In the question you linked, there is, in the comments, a link to this answer on ServerFault, which describes in more details possible umask issues, and suggests to use POSIX extended attributes on the repo directory.


That being said : since your issue is with the .git/COMMIT_EDITMSG file, which is created/edited only when a user types git commit, this suggests you are sharing an active working directory, rather than a bare repo.

There are so many things that can go wrong if you start using concurrently the very same repository :

  • you can't rely on git status, because perhaps Becca typed git add foo right afterwards,
  • you can't rely on git commit, because perhaps Fred ran git checkout side/branch or Melysa ran git reset HEAD~4 while you were typing your commit message,
  • etc ...

Unless you really know what you are doing, do take the time to at least set a shared bare repository, which would be used as the target push/pull repo for all your team.

LeGEC
  • 46,477
  • 5
  • 57
  • 104