Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.
like image 905
Ayush Goyal Avatar asked Sep 20 '12 09:09

Ayush Goyal


People also ask

How do I turn off LF will replace by CRLF?

You should use core. autocrlf input and core. eol input . Or just don't let git change the line endings at all with autocrlf false and get rid of highlighting of crlfs in diffs, etc with core.

What does LF will be replaced by CRLF mean?

In Unix systems the end of a line is represented with a line feed (LF). In windows a line is represented with a carriage return (CR) and a line feed (LF) thus (CRLF). when you get code from git that was uploaded from a unix system they will only have an LF.

What is LF and CRLF in git?

LF. original (usually LF , or CRLF if you're viewing a file you created on Windows) Both of these options enable automatic line ending normalization for text files, with one minor difference: core. autocrlf=true converts files to CRLF on checkout from the repo to the working tree, while core.

What is Unlock index in git GUI?

What does "Unlock Index" do in the Git Gui? It removes the ". git/index. lock" file so that you can run other git commands before continuing. The Git GUI will create this file when it starts a Git command so that no other git processes will interfere and corrupt your local repository.


1 Answers

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.

like image 99
Walf Avatar answered Oct 11 '22 14:10

Walf