Notice Git: LF will be replaced by CRLF


I created a file called tests.html inside a folder.

After typing:

git add tests.html 

The message was displayed:


warning: LF will be replaced by CRLF in tests.html
  The file will have its original line endings in your working directory.

The first time I added a file, no message appeared, but now it has appeared ...

What does LF and CRLF mean?

What does this warning mean or what is happening?

asked by anonymous 17.12.2014 / 20:54

1 answer


Line terminator

  • LF = > Line Feed (ASCII 10)
  • CRLF = > Carriage Return + Line Feed (ASCII 13 + 10)

This is how the lines of text file terminate. Or with just one character or both. In general the former is preferred in one operating system (Linux for example) and the second preferred in another (Windows).

Line terminator is the way the end of each line of a text file is indicated. It needs some character to determine that the line is gone. Typically this character is not shown in text in editors and listings but it is there in the file. Without him how would you know the line is gone? We can say, quite roughly, that this is ENTER that is there.

Some editors have an option to display these characters in a special way.

The ideal is to always keep the same pattern (some softwares may even have problems because of this).

How Git handles this

If there is no consistency Git can convert for you.

This message is only telling you who converted it for you.

You can change this behavior with:

git config core.autocrlf true

But the most common is to leave as

git config core.autocrlf input

You probably recorded the file with a line terminator that is not desirable. Or maybe the file has come from somewhere that has a different terminator.

17.12.2014 / 21:08