Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QUESTION: Git configuration files #2234

Closed
1 task done
levicki opened this issue Jun 15, 2019 · 1 comment
Closed
1 task done

QUESTION: Git configuration files #2234

levicki opened this issue Jun 15, 2019 · 1 comment
Labels

Comments

@levicki
Copy link

levicki commented Jun 15, 2019

  • 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.

@dscho
Copy link
Member

dscho commented Jul 4, 2019

Why is there a second "system" config file in `%ALLUSERSPROFILE%\Git`?

Where do you get that from?

Why is there no dedicated switch (except `-f file`) to reference that config directly?

This file is not supported by "official" Git. Only by Git for Windows. We have a PR up at gitgitgadget#148, but I did not get to it yet (there are so many patches I need to upstream, still, and if you want to help, I will very much appreciate all you can do to review patches on the Git mailing list).

Are the contents of this config file preserved on reinstall?

Partially. It depends on the choices you make in the installer. Those choices will override what is in that file.

@dscho dscho closed this as completed Jul 4, 2019
@dscho dscho added the question label Jul 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants