How to avoid reporting errors when git is submitted: fatal: crlfuld be replaced by lf infile.js?

  git, question

Many articles on the internet say that execute the command gitconfig-globalcore.autocrllftrue, or add the following parts to the. gitconfig file:

 autocrlf = true

It can be realized that Git automatically converts line breaks in files from CRLF to LF during commit, and automatically converts line breaks from LF to CRLF during checkout.

Then why did I still prompt the following error when I was at git commit:

fatal: CRLF would be replaced by LF in file.js

Setting autocrlf to false will not prompt the above error.

My doubt is, not to say that after autocrlf is set to true, git should automatically convert line breaks in files from CRLF to LF, then this is not an error, why should I report an error?

By the way, the IDE I use is phpstorm. Is it a setup problem in the IDE?

My settings:

  1. git config autocrlf=false
  2. Gitattributes file
    text eol=lf

Can also see …

This is not actually an error report, but git will modify the file line breaks according to your system.