Archived post: posted sometime between 2016 and 2022.

git config core.autocrlf

Windows ends lines with carriage-return and linefeed CRLF . Mac and Linux use only a linefeed LF . Enter git config core.autocrlf to the rescue!

View it git config --get core.autocrlf

Set it git config --global core.autocrlf=input

This is what the three alternatives do.

true

input

false

See also https://www.git-scm.com/book/en/v2/Customizing-Git-Git-Configuration#_formatting_and_whitespace