Git under Windows reports an error:
warning: LF will be replaced by CRLF in ××××.××(file name) The file will have its original line ending in your working directory. translation: LF will be replaced by CRLF in the xxx.xx file. In the working directory, this file will keep its original newline character. (Line ending: end of line, newline)
LF: Line feed wrap
CRLF: Carriage Return Line Feed Carriage Return Line Feed
1. Under different operating systems, the methods of handling end-of-line characters are different :
Windows: CRLF (representing two characters with carriage return and line feed at the end of the sentence, that is, “\r\n” line feed under windows)
Under unix: LF (represents the end of a sentence, only use line breaks)
Mac: CR (represents only carriage return)
2. Handling “line ending” under Git
core.autocrlf is the variable responsible for processing line ending in git. You can set 3 values: true, false, and inout.
(1) Set to true [config –global core.autocrlf true ]
When set to true, it means that whenever you add a file to the git repository, git will treat it as a text file.
It will turn crlf into LF.
(2) Set to false [config –global core.autocrlf false ]
When set to false, line endings will not be converted. The text file remains as it is.
(3) When set to input, when adding a file git warehouse, git programs crlf to lf. When someone checks the code, it is still the lf way. Therefore, do not use this setting under the window operating system.
In summary, the reasons for the above warning are:
The line break in windows is CRLF, and the line break in Linux is LF (using the Git command line Git Bash, which is actually equivalent to the linux environment), so this error message will appear when you execute the git add xxx.xx operation!
Solution: (Note: The warehouse will be deleted! The warehouse will be deleted! The warehouse will be deleted!)
<1>Delete .git 【rm -rf .git】
<2>Disable automatic conversion, and set it soon: git config –global core.autocrlf false
Re-initialize and perform the add operation:
<4> 【git add xxx.xx】
- git error: The following untracked working tree files would be overwritten by checkout
- IDEA reports an error. Error XXX reports an error. The class cannot be found
- Git pull and Git pull origin master Warning: Pulling without specifying how to reconcile divergent branches
- Git Pull Error:The following untracked working tree files would be overwritten by merge
- [Solved] git Error: error: Your local changes to the following files would be overwritten by merge
- [Solved] Springboot WARNING: All illegal access operations will be denied in a future release
- Git Pull error: Your local changes to the following files would be overwritten by merge:
- The pip installation package under Windows reports an error: Microsoft Visual C++ 9.0 is required Unable to find vcvarsall.bat
- [Solved] AS Warning: String literal in setText can not be translated. Use Android resources instead.
- An error was reported when Maven package was running the packaged jar package: there is no main list attribute in xxx.jar, which can be solved by configuring Maven plugin
- Android Studio Warning: Process ‘command ‘git‘‘ finished with non-zero exit value 1
- The Ajax return value reports an error, and the spring boot development Ajax return value reports an error
- [Solved] fatal: not in a git directory Error: Command failed with exit 128: git
- [Solved] eggjs Error: Warning: Current Server Discovery and Monitoring engine is deprecated, and will be rem…
- [Solved] Git push Warning: error: RPC failed; HTTP 413 curl 22 The requested URL returned error: 413
- The showdialog() method in thread/threading. Timer/task reported an error: “before ole can be called, the current thread must be set to single thread unit (STA) mode.”
- Android studio reports an error when running the main() method
- Appcompatactivity Error: WARNING: Local History will be also cleared.
- How to Fix Error Cannot find command ‘git‘ – do you have ‘git‘ installed and in your PATH?
- [Solved] swiper Error: The requested module ‘react’ is expected to be of type CommonJS, which does not support named exports. CommonJS modules can be imported by importing the default export