'Git Warning: LF will be replaced by CRLF

I am using Git gui. I see this error for several files in a folder. I have two choice buttons - Unlock index and Continue. I don't understand what the buttons do. I saw other SO posts which tell me to ignore the warning, but they don't mention how to do it in GUI. Please tell me which button I should press and why. Thanks.

Here is the error message sample -

Updating the Git index failed. A rescan will be automatically started to resynchronize git-gui.

warning: LF will be replaced by CRLF in gen/com/click4tab/pustakalpha/BuildConfig.java. The file will have its original line endings in your working directory. (repeat above messages for other files)



Solution 1:[1]

Set up the CRLF and the problem will "disappear"

# Option 1:
git config --global core.autocrlf false

# Option 2:
`git config --global core.safecrlf false`

https://help.github.com/articles/dealing-with-line-endings

Solution 2:[2]

It is not autocrlf matters, but safecrlf. Use below command to suppress the warnings.

git config --global core.safecrlf false

autocrlf is to control whether transform line endings when add/checkout, while safecrlf is to control whether warn users when doing such transformations.

Solution 3:[3]

Soo, i'm have that problem too. I fix it, simple, using by IDE. have a problem

Use IDE (intellij idea). use IDE

And then after use IDE.. no problem) no problem)

Solution 4:[4]

I made some tests and the 2 buttons' behavior is identical. Nothing changed on the file content. I expected an LF -> CRLF replacement. Instead of that (in both cases) I got an error message:

wrong # args: should be "ui_status msg"
    while executing
"ui_status [mc "Ready to commit."] ui_ready"
    ("uplevel" body line 1)
    invoked from within
"uplevel #0 $after"
    (procedure "select_first_diff" line 8)
    invoked from within
"select_first_diff $after "
    (procedure "rescan_done" line 15)
    invoked from within
"rescan_done $fd buf_rlo $after"
    (procedure "read_ls_others" line 14)
    invoked from within
"read_ls_others file2a1c920 {ui_status [mc "Ready to commit."] ui_ready}"

Getting rid of this (for Windows):

In my case, I discovered bad settings of my Notepad++ settings. The use of Unix LF in the newly created documents So at staging between my documents were files using CRLF (the old ones) and files using just LF (the new ones). I converted the newly created document to use CRLF. Because in my opinion is better to have all the file in the same format ... You can use the first comment option. In this case, the tool will omit this (newline) check!

Solution 5:[5]

To fix this issue of line ending you configure git for Windows like this:

git config --global core.autocrlf true

For MacOs/Linux users you configure it as:

git config --global core input

Solution 6:[6]

I had the same problem and then i fixed it using git config --global core.safecrlf false

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 lxvs
Solution 3 Marty McAir
Solution 4 William Prigol Lopes
Solution 5 Sercan
Solution 6 Redissi Oumaima