GIT warning: LF will be replaced by CRLF

在windows下使用git命令时

yangjiabo_000@BOWEN MINGW64 /d/_ALD/CoreApi/Exchange-API-Services (develop)
$ git add .
warning: LF will be replaced by CRLF in src/main/java/com/exchange/controller/UserController.java.
The file will have its original line endings in your working directory

解决方法:

设置core.autocrlf属性
设置core.autocrlf属性为false,去除警告

【查看原有设置】

yangj_000@BOWEN MINGW64 /d/_ALD/CoreApi/Exchange-API-Services (develop)
$ git config --get core.autocrlf
true

yangj_000@BOWEN MINGW64 /d/_ALD/CoreApi/Exchange-API-Services (develop)
$ git config --global --get core.autocrlf

【设置】

yangj_000@BOWEN MINGW64 /d/_ALD/CoreApi/Exchange-API-Services (develop)
$ git config core.autocrlf false

【查看设置结果】

yangj_000@BOWEN MINGW64 /d/_ALD/CoreApi/Exchange-API-Services (develop)
$ git config --get core.autocrlf
false

参考:
配置 Git : :
https://git-scm.com/book/zh/v1/%E8%87%AA%E5%AE%9A%E4%B9%89-Git-%E9%85%8D%E7%BD%AE-Git

GitHub 第一坑:换行符自动转换:
https://github.com/cssmagic/blog/issues/22

GIT使用的一些感受和经验:
http://www.bloggern.com/ProjectItem.php?ProjectItemId=6426

你可能感兴趣的:(GIT warning: LF will be replaced by CRLF)