git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* git gc changes ownerships of files linux
@ 2024-02-10 19:52 K_V
  2024-02-11 15:14 ` Torsten Bögershausen
  0 siblings, 1 reply; 8+ messages in thread
From: K_V @ 2024-02-10 19:52 UTC (permalink / raw)
  To: git

Hi team git

Running 'git -C /srv/mssioncontrol/.git gc' on linux from a user which
has access to another users files will occasionally change the
ownership of the file 'packed-refs'. I believe git actually overwrites
the file with a new one at the end af the gc command. But details
about this is not writen in the help text. Could it be a bug?

Use case: I'm using ansible to cleanup .git directories across
multible servers and this issue is starting to cause problems.

My solution is to make a variable containing the user and group id
before running gc command and then reapply it afterwards:
current_owner_uid_gid=$(stat -c "%u:%g" /srv/mssioncontrol/.git)
git -C /srv/mssioncontrol/.git gc
chown -R $current_owner_uid_gid "/srv/mssioncontrol/.git"

Details:
Debian GNU/Linux 12 (bookworm)
git version 2.39.2

Best:
zinen

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-02-11 19:48 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-10 19:52 git gc changes ownerships of files linux K_V
2024-02-11 15:14 ` Torsten Bögershausen
2024-02-11 15:28   ` brian m. carlson
2024-02-11 15:43     ` Torsten Bögershausen
2024-02-11 16:43       ` Junio C Hamano
2024-02-11 16:59         ` Torsten Bögershausen
2024-02-11 19:09         ` brian m. carlson
2024-02-11 19:48           ` rsbecker

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).