Make Git "LF will be replaced by CRLF" warnings go away

This might happen if you change core.autocrlf config variable (if I understand your problem correctly).

If you are at clean state, i.e. just after commit, and you don't have uncomitted changes, forced re-checkout and removing index should do the trick:

The below command git reset --hard HEAD will make your current branch to point to the latest commit and all uncommitted code will be lost. Make sure to commit the code or take the backup

$ rm .git/index
$ git reset --hard HEAD

That, I think, would sync both working area files, and the index (staging area) to follow crlf settings.


I had this problem when creating new Xcode project. My solution for this problem:

In terminal write

$: git config --global --edit

Then in git config file change safecrlf to false. My settings:

[core]
    autocrlf = input
    safecrlf = false

I know git have cmd line tools for this but they don't work for me. And then Xcode create git repos without any problem.


Only thing I can think of is to check if core.safecrlf is set to warn.

git config --get core.safecrlf

I think possible values are true, false, and warn. I believe that setting to false will resolve the warning, though it may not be a good idea.