wtto WTTO'S BLOG

windows下vscode设置了eof=lf,但是git操作还是会自动把代码变为crlf

Posted on: 2021年7月16日  at 03:22
windows下vscode设置了eof=lf,但是git操作还是会自动把代码变为crlf

背景

  • vscode 已设置 files.eol="lf"
  • 项目文件 .editorconfig 已设置 end_of_line = lf

问题

当执行 git checkout master 切换分支时,编辑器中代码总是自动变为 crlf,导致 eslint 报错所有文件

解决

git 配置以下

git config core.autocrlf false
git config core.eol lf

如果要全局配置,需要加上 --global 参数。

作者:  wtto
发表时间: 2021年7月16日
最后更新时间:  2024年1月1日
版权说明:  CC BY-NC-ND 4.0 DEED