git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Git newbie question: permissions

From
ESEd Schofield <edschofield@gmail.com>
Date
Oct 9, 2008, 20:20 UTC
Message-ID
<1b5a37350810091320l72ae0a86m39db4258c9f4827e@mail.gmail.com>
Hi everyone,

I have a bare git repository that users in a particular group ("webdev") are pulling from and pushing to using the ssh transport. One of the users has just reported this error during a push:

Counting objects: 103, done. Compressing objects: 100% (68/68), done. error: unable to write sha1 filename ./objects/4f/ 973ce5c66f082af5087948cec57001f0c4da50: Permission denied

fatal: failed to write object error: pack-objects died with strange error error: failed to push some refs to '/var/git/myrepo.git'

I'd appreciate some help on getting my repository back to a sane state, allowing this user to finish his push, and making sure permissions are right in the future.

I don't think I specified "--shared=group" when initializing the repository. Afterwards I manually set all files to have 660 permissions, dirs as 770, and set the group ownership to "webdev", but I probably made a mistake by not setting the setgid bit on directories. Now there are some objects directories with 755 permissions and different group ownership (the default groups of the other users).

I have now run "git --bare init --shared=group" to reinitialize the repository. This seems to have changed the directories to be g+sx. (Is this all it did?). There are still some objects directories with 755 permissions rather than 770, which I presume I want, and the group ownership of these is wrong. Shall I change these by hand? The sha1 files all have 444 permissions; is this right?

The last question I have is how to ensure that git creates object files etc. with the right permissions when users push in future.

I'd appreciate any help!
-- Ed
Next: Samuel Lucas Vaz de Mello
Message 1 of 6 in “Git newbie question: permissions”
  1. Ed SchofieldOct 9, 2008
  2. Samuel Lucas Vaz de MelloOct 9, 2008
  3. Marc WeberOct 9, 2008
  4. Samuel TardieuOct 9, 2008
  5. Ed SchofieldOct 9, 2008
  6. Samuel Lucas Vaz de MelloOct 10, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.