git: How do I get rid of "warning: CRLF will be replaced by LF" without disabling safecrlf?
Solution 1:
As far as I can tell, setting core.safecrlf
to false
is the only way to turn off that warning.
safecrlf
is generally not necessary if your attributes are set correctly. The point of safecrlf
is to prevent normalization in a file that is supposed to have mixed (or non-LF) line endings in the repository. It's really only useful in combination with core.autocrlf
(to make sure that its automatic guesses can't destroy anything), and if you're setting your own attributes via .gitattributes
it should be okay to turn all that off.
Solution 2:
In your .gitattributes
you can:
# normalize text files to use lf
text eol=lf
# except these which we want crlf
*.txt eol=crlf
Solution 3:
The short answer to your question is NO.
Because, basically, core.safecrlf setting controls "warning level":
- false - proceed without warning
- warn - proceed with warning
- true - don't proceed
So, you have to choose option that suits you the most.
Solution 4:
use
$ git config core.autocrlf false