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

Re: Git config command ignores explicitly set file permissions

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 18, 2020, 18:32 UTC
Message-ID
<xmqqsgesns22.fsf@gitster.c.googlers.com>
In-Reply-To
<MN2PR02MB66232254F5F4BE27F21C441CD89B0@MN2PR02MB6623.namprd02.prod.outlook.com>
"Riddell, Matthew A" <mriddell@paychex.com> writes:
Show 9 quoted lines
> I noticed while working with Git that the file permissions on the
> gitconfig file is ignored and the parent folder permissions are
> used instead to update the file.  An example is as follows:
>
> Before running git config ensure the user running the command is
> not able to edit the file but has read access to the file. Ensure
> the User has full access to the parent folder.  After running any
> git config command the user previously without edit permissions on
> a file can now edit the config file.

That is pretty much how things are intended to work on a filesystem and is not limited to Git. Your arrangement, contrary to what you said, does not "ensure the user running the command is not able to edit but has read access".

    mkdir newdir
    chmod +rwx newdir
    >newdir/file
    chmod a-w newdir/file
would not forbid you from doing
    rm -f newdir/file
    ehco new >newdir/file

In other words, if you allow your user to write to a directory, you cannot forbid the user from creating and removing files in it.

Previous: Riddell, Matthew ANext: Randall S. Becker
Message 2 of 5 in “Git config command ignores explicitly set file permissions”
  1. Riddell, Matthew AJun 18, 2020
  2. Junio C HamanoJun 18, 2020
  3. Randall S. BeckerJun 18, 2020
  4. Riddell, Matthew AJun 18, 2020
  5. Randall S. BeckerJun 18, 2020

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.