我是 git 的新手,我需要一些帮助。我在 Windows 上使用 msysgit。
当我执行命令 git add [folderName]
时,我得到了响应:
fatal: LF would be replaced by CRLF in [.css file or .js file]
然后,如果您尝试提交,则什么也不会发生。
$ git commit
# On branch master
#
# Initial commit
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# so01/
nothing added to commit but untracked files present (use "git add" to track)
其中一些 css/js 文件是从网上下载的,所以我想这就是为什么有 LF。 如果我打开文件并剪切/粘贴内容,则会在下一个文件中出现错误,依此类推。
任何帮助将不胜感激。
编辑
将 core.autocrlf
设置为 false 似乎可以解决问题,但我在很多帖子中都读到不要将此选项设置为 false。
有人可以指出我在哪里可以找出这种情况下可能出现的问题吗?
最佳答案
对此非常陌生,因此将 core.autocrlf 设置为 false 对我来说意义不大。因此,对于其他新手,请转到 .git 文件夹中的配置文件并添加:
[core]
autocrlf = false
在 [核心] 标题下。
关于Git,将文件添加到存储库会导致 LF ->CRLF 出现 fatal error ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8651708/