BlogStop Git changing line-endings from LF to CRLF on Windows

11th September 2014

If you're using Git in a Windows environment you may see experience this warning when adding files:

warning: LF will be replaced by CRLF in index.php

CRLF is the standard Windows line-ending; LF is the standard Unix line-ending. Git detects that you're on a Windows machine and has detected that your file uses Unix line-endings. This warning is telling you that Git is attempting to change the Unix line-endings to Windows line-endings.

If you want to tell Git to keep the Windows line-endings...

git config --global core.autocrlf false

If you'd like Git to change all Windows line-endings to Unix (recommended)...

git config --global core.autocrlf true

More information is available here: https://help.github.com/articles/dealing-with-line-endings

Let's Talk