在repo中的某个文件中的CRLF替换

在repo中的某个文件中的CRLF替换

本文介绍了尝试提交Git文件但获取:: fatal:LF将被<在repo中的某个文件中的CRLF替换>的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



致命:LF将被CRLF替换< / code>



现在,在我得到通常的 LF和CRLF 答案,我知道并理解辩论的内容。其次,我还将全局设置设置为:

core.autocrlf true



第三,。



因此,我必须确保文件或文件被强制具有 CRLF 。



我不明白的是它说致命并阻止我继续。一个警告?当然!我知道我想要做什么吗?我做!



我只是希望它静静地转换和STFU

另外,if它被迫阻止我,有没有办法可以更新回购中的所有文件为 CRLF ,所以这个警告可能会丢失?



这些repo是私有的,所以它们永远不会在Windows + Visual Studio之外开发。



任何人都可以请求帮助,而不会将此线程贬低为 autocrlf TRUE vs autocrlf FALSE 宗教战争。

解决方案

您可能需要设置 core.safecrlf 到warn,如果你只想警告而不是致命错误。

从:

core.safecrlf

我更喜欢用 .gitattributes 文件来识别我想要强制执行文件的确切文件或类型(使用 core.eol 设置,你有),并保留 autocrlf 为假。



如果文本fiels混合eol,这个博客例如,如下所示:


When I try to commit some changed files, I get the following error message with TortoiseGit

fatal: LF would be replaced by CRLF in <some file in the repo>

Now, before I get the usual LF vs CRLF answers, I know and understand what the debate is about. Secondly, I've also set my global settings to:

core.autocrlf true

Third, I've got a .gitattributes file.

So I -want- to make sure or files are forced to have CRLF.

What I don't understand is that it's saying FATAL and blocking me from continuing. A Warning? Sure! Do I know what I'm trying to do? I do!

I just want it to convert silently and STFU.

Alternatively, if it's forced to BLOCK me, is there a way I can update all files in the repo to be CRLF, so this warning can get lost?

These repo's are private, so they will never be developed outside of Windows + Visual Studio.

Can anyone please help without denigrating this thread into a autocrlf TRUE vs autocrlf FALSE religious war.

解决方案

You might want to set core.safecrlf to "warn", if you want only warning and not a fatal error.

From "git config" mange page:

core.safecrlf

I prefer identifying the exact files or types of file I want to force the eol with .gitattributes files only (with core.eol settings, which you have), and leave autocrlf to false.

In case of text fiels with mixed eol, this blog post suggests, for instance, to:

这篇关于尝试提交Git文件但获取:: fatal:LF将被&lt;在repo中的某个文件中的CRLF替换&gt;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-11 19:55