I'm new to git and I need some help. I'm using msysgit on windows.
When I execute the command git add [folderName]
I get the response:
fatal: LF would be replaced by CRLF in [.css file or .js file]
and then if you try to do a commit nothing happens.
$ git commit # On branch master # # Initial commit # # Untracked files: # (use "git add <file>..." to include in what will be committed) # # so01/ nothing added to commit but untracked files present (use "git add" to track)
Some of these css/js files were downloaded from the net so I guess that's why the have LF. If I open the file and cut/paste the content, then I get the error on the next file and so on.
Any help will be much appreciated.
Edit
Setting core.autocrlf
to false seems to solve the problem, but I read on many posts not to set this option to false.
Can somebody point me where can I find out what problems may arise in this situation?
text eol=crlf Git will always convert line endings to CRLF on checkout. You should use this for files that must keep CRLF endings, even on OSX or Linux. text eol=lf Git will always convert line endings to LF on checkout. You should use this for files that must keep LF endings, even on Windows.
Whereas Windows follows the original convention of a carriage return plus a line feed ( CRLF ) for line endings, operating systems like Linux and Mac use only the line feed ( LF ) character. The history of these two control characters dates back to the era of the typewriter.
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.
very new to this so setting core.autocrlf to false didn't make too much sense to me. So for other newbies, go to the config file in you .git folder and add:
[core] autocrlf = false
under the [core] heading.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With