gitconfignewlinelf

How to turn off Git warnings "LF will be replaced by CRLF"?


I am working on Windows, but may also work on Unix, so I don't need to store Windows line endings. I just want to suppress the warning.

I found these related Stack Overflow questions:

I tried the following:

git config core.whitespace cr-at-eol false<Br>
git config core.whitespace cr-at-eol true<br>
git config core.whitespace cr-at-eol nowarn

But these don't seem to do anything. Does anyone know how to turn off the warnings?


Solution

  • I simply use autocrlf=true in the .git/config file to cover most situations in Windows. There are occasional warnings depending on new source files.

    If you have special files that don't follow the scheme set up a .gitattributes separately for them e.g. I have Matlab files with *.m eol=lf.