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

Re: Behavior of core.sharedRepository on non-bare Repositories

From
brian m. carlson <sandals@crustytoothpaste.net>
Date
Jan 17, 2022, 22:55 UTC
Message-ID
<YeXz0MYd8wduM9W+@camp.crustytoothpaste.net>
In-Reply-To
<20220117223912.fwsydwpkwfbcdlcq@Zulu-1>
On 2022-01-17 at 22:39:12, John A. Leuenhagen wrote:
Show 14 quoted lines
> I've been trying to work with the core.sharedRepository option today.
> 
> Based on the wording in the man page, I was under the impression that
> this would affect all files in any type of repository (bare or not), but
> it seems as though this is not the case. It affects bare repositories as
> one would expect, but it only affects the .git directory on non-bare
> repositories. The working tree is not affected by the option at all.
> 
> I doubt that I'm the first person to encounter this issue, and I'm not
> sure why this behavior would be desirable. If for some reason it is
> discouraged to share a working tree between users in a group, I don't
> believe this option should affect non-bare repositories at all; there
> should be a warning about any dangers associated with this kind of
> setup instead.

I can't speak to how this feature is supposed to work on the working tree, but it is generally the case that users should not share a working tree. Any user who can modify the configuration can cause arbitrary code to be executed by every other user of the repository when they run almost any Git command.

The only safe thing to do with an untrusted repository is perform a clone or fetch from it.

It may be in your case that all the users are trusted (e.g., all system administrators), but in general it's strongly recommended that users not share a working tree. There'll be an entry in the FAQ describing this in the future.

That doesn't mean that this feature couldn't be extended to handle the working tree, but I did want to provide some context on why working trees aren't intended to be shared.

-- 
brian m. carlson (he/him or they/them)
Toronto, Ontario, CA
Previous: John A. LeuenhagenNext: John A. Leuenhagen
Message 2 of 5 in “Behavior of core.sharedRepository on non-bare Repositories”
  1. John A. LeuenhagenJan 17, 2022
  2. brian m. carlsonJan 17, 2022
  3. John A. LeuenhagenJan 17, 2022
  4. Junio C HamanoJan 17, 2022
  5. Junio C HamanoJan 17, 2022

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.