MarkE MarkE - 1 year ago 154
Git Question

Git: Why am I getting a warning LF will be replaced by CRLF when text=lf

I know there are many questions "LF will be replaced by CRL" but I believe my question is unique as I'm attempting to force LF line-endings, even on Windows, so don't want autocrlf=true.

To force the LF I created a .gitattributes in the root of my repostory with a line:

* text=lf

However, when I attempt to add a file now I get the "LF will be replaced by CRLF" warning. Why would it replace with CRLF given my .gitattributes? I believe my global git settings have autocrlf=true, but I thought my .gitattributes would override that.

Another proposed Answer only address .txt files (*.txt), I needed all files determined to be text by git to use LF.

Answer Source

Doh! .gitattributes line should have been

* eol=lf

The warnings can be suppressed using:

git config --global core.safecrlf false
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download