Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to solve the problem of newline characters of AutoCRLF and SafeCRLF in Git

2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article is about how to solve AutoCRLF and SafeCRLF newline problems in Git. Xiaobian thinks it is quite practical, so share it with everyone for reference. Let's follow Xiaobian and have a look.

Recently, using GitHub, I found files that have not been modified from time to time to submit. Compared with the files that have been modified, I can't find anything different. Think it may be a newline problem, because Windows and Linux newlines are not the same, and Git should be Linux by default, Bing today, it is really this problem. CR LF carriage return Windows/Dos CRLF \r\nLinux/Unix LF \nMacOS CR \rSolution is: Open the command line, set it, if you are developing under Windows, it is recommended to set autocrlf to true. 2014/08/20 Supplement: If your file code is UTF8 and contains Chinese text, set autocrlf to false, convert all files to Linux code (LF\n), and turn on safecrlf check. AutoCRLF#is converted to LF when submitted and CRLFgit config --global core.autocrlf true when detected #Convert to LF on submission, not git config --global core.autocrlf input on checkout #Submit checkouts without converting git config --global core.autocrlf false

II. SafeCRLF

#refuse to submit files containing mixed newlines git config --global core.safecrlf true #Allow submission of files containing mixed newlines git config --global core.safecrlf false #Give warning when submitting files containing mixed newlines git config --global core.safecrlf warn

Thank you for reading! About "how to solve the AutoCRLF and SafeCRLF newline problem in Git" this article is shared here, I hope the above content can be of some help to everyone, so that everyone can learn more knowledge, if you think the article is good, you can share it to let more people see it!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report