2021.4.6更新
周末闲来无事,重新check了自己当初对Windows Terminal的配置,发现在powershell的profile中添加了git插件如下:
Import-Module posh-git
Import-Module oh-my-posh
Set-Theme Paradox
删除第一行,重新打开Windows Terminal, 执行git config core.autocrlf
结果如下:
现象
从代码服务器clone同事代码,构建时报错如下:
原因
- 习惯原因,使用了Windows Terminal clone 了代码。
- git 为了兼容跨系统间不同行尾符的问题,进行了行尾符的转换处理,细节请查看:git提交提示CRLF和LF的换行处理问题
- git 官方自带的 bash 中运行
git config core.autocrlf
结果如下:
- Windows Terminal中运行
git config core.autocrlf
结果如下:
- 综上所述,我使用Windows Terminal 克隆代码,检出(checkout)时没有把 CR转换成LRCR,vs识别异常。
解决方法
- 使用git bash重新 clone 代码。
- 设置 Windows terminal 中相关配置。