Skip to content

QUESTION: Git configuration files #2234

Closed
@levicki

Description

@levicki
  • I was not able to find an open or closed issue matching what I'm seeing

Setup

  • Which version of Git for Windows are you using? Is it 32-bit or 64-bit?
$ git --version --build-options

git version 2.22.0.windows.1
cpu: x86_64
built from commit: d003d728ffa6c0006da875ec6318d3f6b28a4ddb
sizeof-long: 4
sizeof-size_t: 8
  • Which version of Windows are you running? Vista, 7, 8, 10? Is it 32-bit or 64-bit?
$ cmd.exe /c ver

Microsoft Windows [Version 10.0.17763.557]
  • What options did you set as part of the installation? Or did you choose the
    defaults?
# One of the following:
> type "C:\Program Files\Git\etc\install-options.txt"

Editor Option: Notepad++
Custom Editor Path:
Path Option: BashOnly
SSH Option: OpenSSH
CURL Option: WinSSL
CRLF Option: CRLFCommitAsIs
Bash Terminal Option: ConHost
Performance Tweaks FSCache: Enabled
Use Credential Manager: Enabled
Enable Symlinks: Disabled
Enable Builtin Interactive Add: Disabled
  • Any other interesting things about your environment that might be related
    to the issue you're seeing?

No.

Details

  • Which terminal/shell are you running Git from? e.g Bash/CMD/PowerShell/other

CMD (irrelevant, see below)

This is more of a question than a bug report, I need clarification about configuration files on Windows platform.

Namely, when I run:

git config -l --system --show-origin

I get the following output:

file:C:/Program Files/Git/mingw64/etc/gitconfig http.sslbackend=schannel
... (shortened for brevity)

And when I run:
git config -l --global --show-origin

I get the following output:

file:C:/Users/<username>/.gitconfig   user.name=Igor Levicki
... (shortened for brevity)

But when I run:

git config -l --show-origin

I also get the following part in the output:

file:"C:\\ProgramData/Git/config"       core.symlinks=false
file:"C:\\ProgramData/Git/config"       core.autocrlf=false
file:"C:\\ProgramData/Git/config"       core.fscache=true
file:"C:\\ProgramData/Git/config"       color.diff=auto
file:"C:\\ProgramData/Git/config"       color.status=auto
file:"C:\\ProgramData/Git/config"       color.branch=auto
file:"C:\\ProgramData/Git/config"       color.interactive=true
file:"C:\\ProgramData/Git/config"       help.format=html
file:"C:\\ProgramData/Git/config"       rebase.autosquash=true`

As far as I know, there are four config locations:

Config file location
    --global              use global config file
    --system              use system config file
    --local               use repository config file
    --worktree            use per-worktree config file

Local and worktree are repository specific so let's ignore them for the moment.

Let me also note that what is called "global" config here is what I would call "user" config since it is in the user's home folder so it is global only in the sense that it is affecting all repositories from the same user.

Furthermore, what is called "local" should perhaps be called "repo" because it would better explain what it is affecting.

With that in mind, my questions are:

  1. Why is there a second "system" config file in %ALLUSERSPROFILE%\Git?
  2. %ALLUSERSPROFILE%\Git is writeable by all users of the system while %ProgramFiles%\Git\mingw64\etc is only writeable by Administrators. If both define the same setting which one will take precedence?
  3. Why is there no dedicated switch (except -f file) to reference that config directly?
  4. Are the contents of this config file preserved on reinstall? If not, why not?

TL;DR — if system-wide settings are not meant to be overrideable by any random user and are stored in application folder (and thus lost on uninstall), what is the rationale behind having this second "system" file?

I apologize in advance if this is explained somewere in documentation but I couldn't find it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions