首页 > 解决方案 > 仍然收到 vscode taskmarks.json 的 git LF 警告

问题描述

虽然我在 git 中执行 LF 将被 CRLF 取代 - 那是什么,它重要吗?

git config core.autocrlf true

我仍然得到

警告:LF 将被替换为 .../.vscode/taskmarks.json 中的 CRLF

如何真正解决这个问题?

标签: gitvisual-studio-code

解决方案


请参阅“ git 用 CRLF 替换 LF ”:

警告“ LF will be replaced by CRLF”表示您(拥有autocrlf=true)将在提交签出周期后丢失您的 unix 风格的 LF(它将被 windows 风格的 CRLF 取代)。
Git 不希望你在 windows 下使用 unix 风格的 LF

(因此警告)

确保你没有像 .gitattributes 这样的指令* text=auto
您可以设置core.safecrlf为 false,但不能使用 Git 2.17/2.18:请参阅“尝试提交 Git 文件但获取:fatal: LF would be replaced by CRLFin<some file in repo> ”:您需要 Git 2.19。


推荐阅读