Introduce
Github Desktop prompt: "This different contains a change in line endings from' lf' to' crlf'."
This diff contains a change in line endings from ‘LF’ to ‘CRLF’
Github提示:"此差异包含行尾从' LF '到' CRLF '的更改。"
Solution
You should set your git config to have the autocrlf option set, so lines are not comited as crlf. Run this on the command line:
您应该将git配置设置为autocrlf选项,这样行就不会被指定为crlf。在命令行上运行以下命令:
git config --global core.autocrlf true
This will make git handle line endings in a much better way. It will also, annoyingly, make git complain a bunch, so you’ll also want to turn off the complaints:
这将使git以更好的方式处理行尾。令人恼火的是,它还会让git抱怨个不停,所以你也想关掉这些抱怨:
git config --global core.safecrlf false
You can open you git configuration file and check what settings are active currently with
您可以打开git配置文件,检查当前哪些设置是活动的
git config --global --edit
It’s also possible to skip the global settings if you want other projects to have other settings.
如果您希望其他项目有其他设置,也可以跳过全局设置。
Summary
Now your Github Desktop submission code should be normal.
现在你的Github Desktop提交代码应该正常。
