简体   繁体   English

Git用CRLF替换了我所有的LF - 我该如何解决这个问题?

[英]Git replaced all of my LF with CRLF - How do I fix this?

I just ran a 我跑了一个

git add -A

on my first git project. 在我的第一个git项目上。

I got back about a thousand responses: 我收到了大约一千条回复:

"warning: LF will be replaced by CRLF" “警告:LF将被CRLF取代”

as it went through each file (Ruby files, some are gems). 因为它经历了每个文件(Ruby文件,有些是宝石)。

I deleted my .git directory and tried to disable this default setting by typing this command: 我删除了我的.git目录并尝试通过键入以下命令禁用此默认设置:

git config core.autocrlf false

Then I tried to add the files again: 然后我尝试再次添加文件:

git add -A

But I got the same result. 但我得到了同样的结果。 Help! 救命!

You likely have the core.autocrlf attribute set to true 您可能将core.autocrlf属性设置为true

It's a configuration attribute you can set: 这是您可以设置的配置属性:

http://git-scm.com/docs/gitattributes#_checking_out_and_checking_in http://git-scm.com/docs/gitattributes#_checking_out_and_checking_in

To make sure that is set to false for all Git projects you can do: 要确保所有Git项目都设置为false,您可以执行以下操作:

git config --global core.autocrlf false

Hope this helps! 希望这可以帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM