git gc changes ownerships of files linux

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux