I’m sorry, but I just hate when Git is messing with my files… That’s just not its job!
warning: CRLF will be replaced by LF in …
The file will have its original line endings in your working directory.
Local fix
To fix it on your computer, set core.autocrlf
to `false
.
> git config --show-origin core.autocrlf
Then either edit the file manually, or do one of the following:
> git config --system core.autocrlf false
# User level (probably preferred)
> git config --global core.autocrlf false
# Repo level (no point, use .gitattributes instead)
> git config --local core.autocrlf false
Shared repository fix
For shared projects, others might not have set this or even want to set this, so to prevent issues there, creating a .gitattributes
file at the root of the repo with the following contents should fix things:
Source: How to express core.autocrlf = false with .gitattributes
Renormalization
For already messed up repos or working-copies, after changing core.autocrlf
, you might be able to renormalize the files one of the methods described in this answer on StackOverflow.