Updating the Git index failed, LF will be replaced by CRLF?

Ayush Goyal picture Ayush Goyal · Sep 20, 2012 · Viewed 10.3k times · Source

I'm using git-gui for version control and pushing them to remote locations. When I tried to Rescan files for changes, I got this message and I'm not sure what that means. Please help me out here.

enter image description here

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

warning: LF will be replaced by CRLF in bin/jarlist.cache.
The file will have its original line endings in your working directory.
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.
warning: LF will be replaced by CRLF in proguard-project.txt.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in project.properties.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in res/layout/start_test.xml.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in res/menu/start_test.xml.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in src/com/click4tab/pustakalpha/StartTestActivity.java.
The file will have its original line endings in your working directory.

Answer

Walf picture Walf · Aug 20, 2014

The solution is to accept that behaviour. You're on Windows so you should have autocrlf as true. It's there so line-endings in Git's internal records are consistent. The warnings are there so you can see if you're about to accidentally corrupt binary files during a commit.

Click Continue. If you want to prevent it happening on those files again, you need to unstage those files, then correct the line-endings and stage them again. Do so by changing the line-endings of the file to CRLF/Windows in your editor, or drop these command line tools into your system32 directory so you can do unix2dos some_file.java on such files at any command prompt.