扩展@SimonBoudrias的优秀答案, git config --global core.autocrlf true 要求git在结账时将行尾从LF转换为CRLF。对于在Windows上工作的开发人员非常有用。此命令将添加以下内容到 %HOMEPATH%\.gitconfig :
git config --global core.autocrlf true
%HOMEPATH%\.gitconfig
[core] autocrlf = true
从运行命令 Git Bash 是最好的,但上面的行可以手动添加到 .gitconfig 如果你觉得容易的话。
Git Bash
.gitconfig