Home > Net >  Ubuntu subsystem on Windows - changes line endings even though I've defined the core.autocrlf t
Ubuntu subsystem on Windows - changes line endings even though I've defined the core.autocrlf t

Time:01-03

I'm launch VSCode from an Ubuntu commandline on my Windows machine. I noticed that it was changing the line endings from the default Windows line ending. Specifically, when I was doing git diffs, I would see stuff like this:

enter image description here

Notice the ^M

So I read an article about how to fix this and it suggested the following git config change:

 git config --global core.autocrlf true

But I'm still seeing these line endings being used when I update my code.

CodePudding user response:

The only thing you would read from me is: "What is the correct core.autocrlf setting I should use?"

Meaning:

git config --global core.autocrlf false

Then, as mentioned in "Disable git EOL Conversions":

git add --renormalize .

Using .gitattributes core.eol directive is the right approach to fix eol.
And you can check what is applied to which file with:

git ls-files --eol
  • Related