From: "Torsten Bögershausen" <tboegi@web.de>
To: K_V <zinen2@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: git gc changes ownerships of files linux
Date: Sun, 11 Feb 2024 16:14:55 +0100 [thread overview]
Message-ID: <20240211151455.GA27103@tb-raspi4> (raw)
In-Reply-To: <CABkRduQNdgdF8WhZadP5hyYvpEWgP_AE8=qzxNiRNA71bdJcYQ@mail.gmail.com>
On Sat, Feb 10, 2024 at 08:52:22PM +0100, K_V wrote:
> 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
Thanks for reporting this -
I think that you have a working workaround ?
However, Git has a feature called "shared repository".
You need to define a (unix) group that is shared between
your user(s) and the ansible user.
The basic trick is to do
git config core.sharedRepository true
(And then change the ownership of all files/directories to the new group)
There is a docu here, please search for core.sharedRepository
https://git-scm.com/docs/git-config
I wonder, which solution is easier to maintain ?
>
> Best:
> zinen
>
next prev parent reply other threads:[~2024-02-11 15:15 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-10 19:52 git gc changes ownerships of files linux K_V
2024-02-11 15:14 ` Torsten Bögershausen [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240211151455.GA27103@tb-raspi4 \
--to=tboegi@web.de \
--cc=git@vger.kernel.org \
--cc=zinen2@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).