Question type
In windows, the new line character is CRLF, while in Linux, the new line character is lf . The prompt: warning : LF will be replaced by CRLF in README . md . The file will have its original line endings in ;
$ git add .
warning: LF will be replaced by CRLF in text 1/README.md.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in text 2/README.md.
The file will have its original line endings in your working directory.
Cause of the problem
Settings core.autocrlf=true Post: when checking out, GIT will convert the newline character of the text file to CRLF (only convert the pure lf file). When submitting, GIT will convert the contents of the temporary storage area (that is, the changes we made to the workspace) to LF, and then put it into the version library. When converting the contents of the temporary storage, lf will be converted to CRLF if lf newline character is found in it, and a very important sentence is given below the warning: “LF will be replaced by CRLF”: warning: LF will be replaced by CRLF in.
the file will have its original line endings in your working In the workspace, this file will keep its original newline character
Simply put, set core.autocrlf=true After that, the files in our workspace should be wrapped with CRLF. If LF is introduced when the file is changed, or if the core.autocrlf Previously, the workspace already had lf newlines. When you submit changes, GIT will warn you which files are not pure CRLF files, but git will not modify those files in the workspace without authorization, but modify the temporary storage area (our changes to the workspace).
Best solution
Direct setting core.autocrlf=false ;
Except Notepad editor, everything else is OK
git config -–global core.autocrlf false // Disable automatic conversion
git rm -rf cached . // Clear the cache added to the cache
git add .
git commit -m "Commit the notes"
git push origin master // Push to remote repository
Similar Posts:
- On branch master nothing to commit, working tree clean ERROR: Repository not found. fatal: Could …
- [git] warning: LF will be replaced by CRLF
- Conflict between git windows and MAC newline
- [git] warning: LF will be replaced by CRLF | fatal: CRLF would be replaced by LF
- Git Warning: LF will be replaced by CRLF | fatal: CRLF would be replaced by LF
- [Solved] Expected linebreaks to be ‘LF’ but found ‘CRLF’.
- Git Submit Error: The file will have its original line endings in your working directory.
- [Solved] json.decoder.JSONDecodeError: Expecting ‘,‘ delimiter: line xx column xx (char xxx)
- [Solved] SyntaxError: unexpected character after line continuation character
- After modifying Tomcat’s server.xml, the Tomcat deployment project reported an error: removing observe files from server… Could not clean server