Git commit line break problem: LF would be replaced by CRLF

When submitting git records, I encountered a problem

fatal: LF would be replaced by CRLF 

insert image description here

Reason :
Unix/Linux uses LF because of git line breaks, and Mac also uses LF later, but Windows has always used CRLF

Solution: Prohibit conversion of file formats, and secondly allow submission of files with newline characters

#禁止自动转换文件格式
git config --global core.autocrlf false
#允许提交包含混合换行符的文件
git config --global core.safecrlf false

Open the command line and execute the above two commands:
insert image description here
After execution, switch back to the git tool and submit. Here is sourcetree. From the figure below, you can see that all files can be submitted.
insert image description here
Finally, you need to restore the original state, execute the following command line. Avoid problems: When committing, the entire file is committed with changes, not the modified parts.
insert image description here

Supongo que te gusta

Origin blog.csdn.net/hexingen/article/details/131912793
Recomendado
Clasificación