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

RE: Git config command ignores explicitly set file permissions

From
Randall S. Becker <rsbecker@nexbridge.com>
Date
Jun 18, 2020, 21:37 UTC
Message-ID
<023601d645b8$b06f46f0$114dd4d0$@nexbridge.com>
In-Reply-To
<MN2PR02MB66237FBAE6695D80B1182BA5D89B0@MN2PR02MB6623.namprd02.prod.outlook.com>
On June 18, 2020 4:57 PM, Matthew wrote:
Show 12 quoted lines
> > "Riddell, Matthew A" <mriddell@paychex.com> writes:
> > > 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.
> 
> >>Forgive me to asking, but is this an attempt at replicating what other
VCS
> systems do? ClearCase is an example where files are forced to read-only
and
> if the user wants to modify it, then they have to ask nicely for a >>lock
on the
> file. The use of "read only" is a semi-guarantee that a user will not
modify
> code and interfere with other users. In git, the rules are quite
different,
> where modification resolution occurs later in the process.
> 
> We have had problems in our continuous integration environment with builds
> modifying the global configuration of tools. I came across this issue
trying to
> lock down our git global configuration for the local user running our
builds.
> The workaround I found is creating a symlink from the user home directory
> to another folder (which has read only permissions) which contains the
> actual gitconfig file.

As a suggestion, you might want to add a git status -uno --porcelain to key parts of your scripts to find the conditions where that is occurring and fail the job if the output is not empty. CI tools and applications should not change configurations unexpectedly and that would be a pipeline stage failure - in my books anyway.

Previous: Riddell, Matthew A
Message 5 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.