Start with this must read post: cross platform – What’s the best CRLF handling strategy with git? – Stack Overflow.
Then read all the links in that answer, especially
Then see if you agree with my conclusion:
use a .gitattributes file to steer line ending conversions on a per-repository base.
I usually try to have git not mess with any line endings: check-out as-is, check-in as is.
Historically this has been a mess (not limited to, but prevalent on Windows installations), not just because core.autocrlf has been superseded by core.eol, so below are some links that will help.
TL;DR
Always execute these after installing git:
git config --global core.autocrlf false
git config --global core.eol native
If needed, repeat in the current repository:
git config --local core.autocrlf false
git config --local core.eol native
Finally verify the settings with git config --list --show-origin (via [WayBack] Where does git config –global get written to? – Stack Overflow)
Note
The git config list will show equals signs. Do NOT use these when setting values: that will silently fail.
So these fail:
git config --global core.autocrlf=false
git config --global core.eol=native
git config --local core.autocrlf=false
git config --local core.eolnative
Despite the output when listing on a machine that already had these values et:
git config --list | grep -w 'core.autocrlf\|core.eol'
core.autocrlf=false
core.eol=native
core.autocrlf=false
core.eol=native
References
–jeroen
PS: To look at the various local and global settings, read Where does git config –global get written to? – Stack Overflow.