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

Git destroys u+s and g+s directory modes

From
HDHadmut Danisch <hadmut@danisch.de>
Date
Dec 27, 2025, 02:37 UTC
Message-ID
<eb36360d-f539-4f77-b175-57330ef05eac@danisch.de>
Hi,

(please respond to my e-mail as well, not just to the list, I'm not subscribed),

I do have a problem with git 2.43.0 (ubuntu server 24.04.3) and directory modes:

I do need my git repo (owned by me) to be readable by a system user (running a rootless podman container).

I therefore set a special group for the directory, and set the sgid bit of the directory ( chgrp ... and chmod 2770 ), but when doing a git clone onto that directory, git rewrites all file modes, including the one of the root directory, and the  S_ISGID is lost.

The only setting I found about file modes is core.fileMode, but git docs tell that this is for file systems that do not keep permissions correctly, such as CIFS or Windows bases file systems, not for keeping git from changing.

The only way I found is to define a hook to correctly set modes after git pull.

Is there a way to keep git from destroying group permission and S_ISGID?
If not: Proposal to set a bit mask with file mode flags git shouldn't touch?
regards
Hadmut
Next: Michal Suchánek
Message 1 of 9 in “Git destroys u+s and g+s directory modes”
  1. Hadmut DanischDec 27, 2025
  2. Michal SuchánekDec 27, 2025
  3. rsbecker@nexbridge.comDec 27, 2025
  4. Hadmut DanischDec 27, 2025
  5. rsbecker@nexbridge.comDec 27, 2025
  6. Andreas SchwabDec 27, 2025
  7. Gabor GombasDec 27, 2025
  8. Hadmut DanischDec 27, 2025
  9. Jeff KingJan 2, 2026

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.