Total Pageviews

2018/01/06

[Git] fatal:LF would be replaced by CRLF

Problem
As I try to use the git add command adds a change in the working directory to the staging area, it show the error:
fatal: LF would be replaced by CRLF


Here has a post to solve this problem: https://albert-kuo.blogspot.tw/2016/12/git-fatal-lf-would-be-replaced-by-crlf.html

But if I have hundreds of file have this problem, how to solve this problem?


Solution

Step 1. download file from http://www.bastet.com/uddu.zip

Step 2. Unzip and copy UNIX2DOS.EXE and UNIX2DOS.C to the root directory of your project.


Step 3. Assign the file extension you would like to do replacement in the command and execute this command:

for /f %f IN ( 'dir /b /s *.xml *.pom *.sha1' ) DO @unix2dos %f

Step 4. Remove  UNIX2DOS.EXE and UNIX2DOS.C from your project.

No comments: