How can I print out the value of a git configuration setting (core.autocrlf) on Windows?

Viewed 38782

I'm trying to fix a problem with CRLF on Windows.

How do I see what the value of the configuration setting core.autocrlf is set to on my system?

6 Answers

To read from particular value from a git configuration files ,

git config --system –get core.autocrlf

Reads the value core.autocrlf from configuration file of Git set at System level.

There are 3 levels of configuration files for git :

1) Local (use --local)

2) System (use --system)

3) Global (use --global)

Q) What will happen if I skip to mention the level of a file ?

In case of Read operation , then value will be searched in all the 3 configuration files.

git config –get core.autocrlf

Q) What does it mean if it does not print anything ?

It simply means , that no such configuration is set.

Q) What if a configuration value is mentioned in all 3 files ? Which will it show ?

Well, highest priority to local , then global and then system. Sometimes a config variable can have multiple value , say in local. In that case the last value mentioned in the local config file, it will show.

Q) What if I want to see all values for a config variable ?

Use --get-all like

git config --local --get-all core.autocrlf

Q) What happens if I write git config --get-all core.autocrlf ?

Clearly you have skipped to write the level of file , hence in that case it shows for all files and all values mentioned in them for this config variable.

Related