Tag Archives: Git Warning

Git Warning: LF will be replaced by CRLF | fatal: CRLF would be replaced by LF

These two errors were encountered because of GIT’s newline check function.

core.safecrlf

Git provides a newline checking function( core.safecrlf ), you can check whether the file is mixed with different styles of newline at the time of submission. The options for this function are as follows:

false - Does not do any checking
warn - check on commit and warn
true - check at commit time and reject commit if a mixup is found

The most stringent true option is recommended.

core.autocrlf
if you are writing programs on windows, or if you are working with other people who are programming on windows and you are on other systems, you may encounter end of line problems. This is because Windows uses carriage return and line feed to end a line, while Mac and Linux only use line feed. Although this is a small problem, it can greatly disrupt cross platform collaboration.

Git can automatically convert line terminator CRLF to LF when you submit, and LF to CRLF when you check out code. use core.autocrlf To turn on this function. If it is on a Windows system, set it to true, so that when checking out the code, lf will be converted to CRLF:

$ git config --global core.autocrlf true

Linux or MAC systems use lf as the line terminator, so you don’t want git to do automatic conversion when checking out a file; when a file with CRLF as the line terminator is accidentally introduced, you definitely want to fix it core.autocrlf Set to input to tell git to convert CRLF to LF when submitting and not when checking out

$ git config --global core.autocrlf input

in this way, CRLF will be retained in check-out files on Windows systems, and LF will be retained on MAC and Linux systems, including warehouses.

If you are a Windows programmer and are developing a project that only runs on windows, you can set false to cancel this function and record the carriage return in the library

$ git config --global core.autocrlf false

How to Solve Git Warning: possible DNS spoofing detected

Today the company updated the git address and after changing the hosts it still reports the following error.

This requires removing the /.ssh/known_hosts file to allow ssh to re-authenticate.

Push failed

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

@ WARNING: POSSIBLE DNS SPOOFING DETECTED! @

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

The ECDSA host key for xxx.git.com has changed,

and the key for the corresponding IP address 123.xx.xx.xx is unknown.

This could either mean that DNS SPOOFING is happening or the IP address for the host and its host key have changed at the same time. @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!

Someone could be eavesdropping on you right now (man-in-the-middle attack)! It is also possible that a host key has just been changed.

The fingerprint for the ECDSA key sent by the remote host is SHA256:a3kdaf8Axxxxxxxxxxxxxx.

Please contact your system administrator. Add correct host key in /c/Users/xxxxx/.ssh/known_hosts to get rid of this message.

Offending ECDSA key in /c/Users/xxxxx/.ssh/known_hosts:1 ECDSA host key for xxx.git.com has changed and you have requested strict checking.

Host key verification failed. Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.