Reputation: 75
My main code editor is VS Code. I don't have any Windows-based projects so I save all my work with line ending set to LF.
While adding my files to git staging area I got this message:
warning: LF will be replaced by CRLF
I've checked documentation and similar questions and set core.autocrlf
to input
using this command: git config --global core.autocrlf input
My question is: is it Ok that inside my git settings file now I have both lines
core.autocrlf=true
and core.autocrlf=input
?
Here is the whole file:
$ git config -l
core.symlinks=false
core.autocrlf=true
core.fscache=true
color.diff=auto
color.status=auto
color.branch=auto
color.interactive=true
help.format=html
rebase.autosquash=true
http.sslcainfo=C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt
http.sslbackend=openssl
diff.astextplain.textconv=astextplain
filter.lfs.clean=git-lfs clean -- %f
filter.lfs.smudge=git-lfs smudge -- %f
filter.lfs.process=git-lfs filter-process
filter.lfs.required=true
credential.helper=manager
core.editor='C:\Program Files\Microsoft VS Code\Code.exe' --wait
user.email=***
user.name=***
core.autocrlf=input
Is it Ok or I should delete that second line autocrlf=true
? It's a little bit confusing because I thought that mentioned above command will replace/update that second line inside settings.
Thank you
Edit:
here is git config -l --show-origin
output:
$ git config -l --show-origin
file:"C:\\ProgramData/Git/config" core.symlinks=false
file:"C:\\ProgramData/Git/config" core.autocrlf=true
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
file:C:/Program Files/Git/mingw64/etc/gitconfig http.sslcainfo=C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt
file:C:/Program Files/Git/mingw64/etc/gitconfig http.sslbackend=openssl
file:C:/Program Files/Git/mingw64/etc/gitconfig diff.astextplain.textconv=astextplain
file:C:/Program Files/Git/mingw64/etc/gitconfig filter.lfs.clean=git-lfs clean -- %f
file:C:/Program Files/Git/mingw64/etc/gitconfig filter.lfs.smudge=git-lfs smudge -- %f
file:C:/Program Files/Git/mingw64/etc/gitconfig filter.lfs.process=git-lfs filter-process
file:C:/Program Files/Git/mingw64/etc/gitconfig filter.lfs.required=true
file:C:/Program Files/Git/mingw64/etc/gitconfig credential.helper=manager
file:C:/Program Files/Git/mingw64/etc/gitconfig core.editor='C:\Program Files\Microsoft VS Code\Code.exe' --wait
file:C:/Users/Wladyslaw/.gitconfig user.email=***
file:C:/Users/Wladyslaw/.gitconfig user.name=***
file:C:/Users/Wladyslaw/.gitconfig core.autocrlf=input
Upvotes: 0
Views: 2348
Reputation: 706
There are 3 "levels" of git config – system, global and local.
As you can see, you've set core.autocrlf
to input
in the global config, and to true
in your system config. In the end, for your user, global configuration of this var will take over the system one and it will be input
. Unless you also set it in the local (repo-level) config.
And yes, it's a common practice.
Upvotes: 1