I'm trying to set core.autocrlf=true
. But after executing git config --global core.autocrlf true
the output of git config -l
shows both these lines
core.autocrlf=false
... other settings ...
core.autocrlf=true
Why is this, and how can I ensure that autocrlf
gets properly set to true
?
The git config core. autocrlf command is used to change how Git handles line endings. It takes a single argument. On macOS, you simply pass input to the configuration. For example: $ git config --global core.autocrlf input # Configure Git to ensure line endings in files you checkout are correct for macOS.
The default for core. autocrlf is false, meaning that Git will not adjust the end of line, which could lead to CRLF files ending up in the repository (bad). Therefore, it is generally best to set the above configuration for Linux and Windows to ensure that the repository will only contain files with LF .
autocrlf = true This means that Git will process all text files and make sure that CRLF is replaced with LF when writing that file to the object database and turn all LF back into CRLF when writing out into the working directory.
You can know more with Git 2.8+:
git config -l --show-origin
That will give you a better idea from where those settings come from.
Local config override global settings which overrides system settings.
See a concrete example in "Where do the settings in my Git configuration come from?".
Xavi Montero points out to the Pro Book "Getting Started - First-Time Git Setup" which mentions:
If you are using version 2.x or later of Git for Windows, there is also a system-level config file at
C:\Documents and Settings\All Users\Application Data\Git\config
on Windows XP, and- in
C:\ProgramData\Git\config
on Windows Vista and newer.This config file can only be changed by
git config -f <file>
as an admin.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With