How do I change the core.autocrlf to work with LF line break in git?

Question:

I am running into a problem with git and Windows . It turns out that the work team is working on linux and I find myself with Windows , so when I make a commit the line breaks that take me into account are Windows and therefore the people who make the publications tell me that I should change this to Linux format.

Searching in English SO, it says to just do:

git config --global core.autocrlf false

the configuration should be changed, but, for some reason, when I do it it leaves me in true , in other words I see no effect. The complete code:

git config --global core.autocrlf false

C:\xampp\htdocs\DDDDD\public>git config --list
core.symlinks=false
core.autocrlf=true
color.diff=auto
color.status=auto
color.branch=auto
color.interactive=true
help.format=html
http.sslcainfo=C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt
diff.astextplain.textconv=astextplain
rebase.autosquash=true
core.edito=atom --wait
core.autocrlf=false
push.default=simple
user.name=Wilfredo Perez
user.email=wilfredo.perez@XXXXXX.com
core.repositoryformatversion=0
core.filemode=false
core.bare=false
core.logallrefupdates=true
core.symlinks=false
core.ignorecase=true
core.hidedotfiles=dotGitOnly
remote.origin.url=https://bitbucket.org/XXXXX
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.master.remote=origin
branch.master.merge=refs/heads/master

At the end of the day, according to the docs, I don't know if they go in false or input. Can someone guide me?

Answer:

What you are seeing are the local configuration values, not global. The git configuration can be defined at various points, but the most specific one takes precedence. If you want to see the global values ​​you have to include the flag

git config --list --global

But the configuration of the repository you are working on has the value core.autocrlf=true and it is the one that will be used to work in this repository.

On the other hand, the recommended value if you are working in Windows is to leave autocrlf in true . What this does is that when you checkout changes to the repository line will be converted to Windows (CRLF) format but only locally, when you do a commit changes line will be converted back to the orginal format. That is, if it was already saved in the repository as Windows, it remains like this, if it was Linux (LF) it converts it.


In your specific case you have 2 options to change the configuration:

You remove the value from the configuration in the local repository in such a way that the global value is enforced:

git config --unset core.autocrlf

You change the local value to the one you want, note that --global is not used --global , you just have to execute it from the repository folder

git config core.autocrlf false
Scroll to Top