I'm working on a repo in Windows. The repo was originally created on a mac and all files in it use LF only for line endings. When I clone the repo on another mac I see that all files have LF as the line ending. When I clone on Windows, some files, but not all, have the line endings as CRLF. core.autocrlf
is set to false. There are no attributes on the files as checked with git check-attr -a foo
. If I run:
git rev-parse HEAD:foo # Outputs "abc123...abc"
git cat-file -p "abc123...abc" | xxd
Then I see the file with LF endings. (I installed xxd on windows to try and minimize tooling that could be introducing errors after discovering that git cat-file -p ... > temp.txt
was changing the encoding to UTF-16)
git status
shows that there are no changes to foo
. If I convert the line endings in foo
from CRLF to just LF, then git status
shows that there are changes. Even though the file should only ever have had LF.
If I drop into WSL on Windows and run git status
then it shows all the files with the errant CRs in them as being changed. "Git Bash" gives the same results as Windows however.
What on earth is going on? How do I make git stop changing my line endings?