1、不一样操系统下的换行符
CR回车 LF换行
Windows/Dos CRLF \r\n
Linux/Unix LF \n
MacOS CR \r
2、解决方法git
打卡git bash,设置core.autocrlf和core.safecrlf(可不设置),建议设置autocrlf为input,safecrlf为true,同时设置你的Eclipse、IDEA等IDE的换行符为LF\n。
下面为参数说明,--global表示全局设置bash
2.一、autocrlfspa
#提交时转换为LF,检出时转换为CRLF
git config --global core.autocrlf true ip
#提交时转换为LF,检出时不转换
git config --global core.autocrlf input input
#提交检出均不转换
git config --global core.autocrlf falseit
2.二、safecrlfcli
#拒绝提交包含混合换行符的文件
git config --global core.safecrlf true 方法
#容许提交包含混合换行符的文件
git config --global core.safecrlf false 文件
#提交包含混合换行符的文件时给出警告
git config --global core.safecrlf warnco