Rafael Dazcal
Rafael Dazcal

Reputation: 355

Where are Git default core configurations coming from

I know about the differences between System, Global and Local configurations in Git. And I know local configurations are stored in .git/config file

However, when I do a fresh clone of the repository, the local config is already populated, so for instance I see:

[core]
repositoryformatversion = 0
filemode = false
bare = false
logallrefupdates = true
symlinks = false
ignorecase = true

My question is - where do these default local configurations come from, and how can I change these defaults?

I know I can change my local configuration, but I have two problems with that:

  1. Next clone will get same defaults, which I don't want
  2. I maintain a repository for several users, so I want it to change for everybody

Thanks in advance

Upvotes: 0

Views: 57

Answers (2)

Edward Thomson
Edward Thomson

Reputation: 78623

My question is - where do these default local configurations come from, and how can I change these defaults?

These are - for the most part - not defaults. This is not configuration you should change, this is a cache of information about your system.

For example, hen you create a repository, git detects whether your filesystem is case sensitive or not. It writes the core.ignorecase setting as a cache, so that it does not have to detect this again in the future, which would otherwise be a time waster for every git command.

You should not change this; it impacts how git operates with your filesystem. Again, it is not a setting with a default, it is a cache of your system’s detected behavior.

The exception to this is logallrefupdates which is indeed configuration. However, this (like any other configuration) cannot be cloned and you should find a mechanism to distribute configuration out of band (like an init script).

(But don’t change settings like core.ignorecase.)

Upvotes: 3

Richard Wan
Richard Wan

Reputation: 34

You can run this command:

git config --list --show-origin

This will give you a list of files of where each config is set globally. More detail can be found on this post

Upvotes: 0

Related Questions