I\'m using Ubuntu 13.10 x64, and I am working on a project that some developers are using Windows , I recently changed the git config core.eol
to \"lf\" and
This is a classic issue:
(picture from Luis Tubes's blog post)
The usual fix is to convert those files yourself, with dos2unix or Swiss File Knife.
I have always preferred to keep core.autocrlf to false, which means:
git config --global core.autocrlf false
I faced same trouble and fixed with editing .gitattributes
as below.
$ vim .gitattributes
comment out 2 lines in .gitattributes
-* text=auto
-* text eol=lf
+# * text=auto
+# * text eol=lf
I'm on a Mac using Terminal and had this problem with an .htaccess file I was trying to commit, getting the fatal error:
fatal: CRLF would be replaced by LF in .htaccess
I wanted to fix the problem, like the OP requests, not just turn off a git flag, so I found this article that gives a perl command to fix the problem on a per file basis.
perl -pi -e 's/\r\n/\n/g' input.file
So for my .htaccess error above, I ran the following:
perl -pi -e 's/\r\n/\n/g' .htaccess
The flags -p, -i and -e (pie) can be combined to allow you to edit files using Perl from the command line. In this case replacing all \r\n found with \n.