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】
- How to Solve ModuleNotFoundError: No module named ‘_bz2‘
- OS.Removedirs() and shutil.Rmtree() are used to delete the folder
- [How to Fix]Type error: must use keyword argument for key function
- Type error: must use keyword argument for key function
- git error: The following untracked working tree files would be overwritten by checkout
- Solve the problem that the native machine cannot use ant script checkout project
- The drone settings page is not trusted
- Error:scalac: missing or invalid dependency detected while loading class file ***
- Git Pull Error: RPC failed; curl 56 OpenSSL SSL_read: SSL_ERROR_SYSCALL, errfno 10054
- Error: uncaughtexception: cannot find module ‘internal / util / types’
- Analysis of npm error ENOTFOUND npm ERR! network request to https://npm.***.com/*** failed and the role of the .npmrc file
- The use of vue-echarts and compilation error solutions
- Yarn add package loading error: operation not permitted, unlink …
- Tidb2.1 reports Error statement count 5001 exceeded the transaction limit, autocommit = false
- Uncaught Error: Error calling method on NPObject.
- maven Error: Element ‘dependency’ cannot have character [children], because the type’s content type is
- Solve the VUE startup problem (You may use special comments to disable some warnings)
- On error resume next, on error goto 0, err usage
- Git pull and Git pull origin master Warning: Pulling without specifying how to reconcile divergent branches
- Vue: How to Solve Error uncaught (in promise) cancel