Git:ファイルの元の行末は作業ディレクトリにあります



Git File Will Have Its Original Line Endings Your Working Directory



root@xxxxx MINGW64 /d/IdeaWorkSpace/es-api-guang (master) $ git add . warning: LF will be replaced by CRLF in .gitignore. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in .mvn/wrapper/maven-wrapper.properties. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in mvnw. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in mvnw.cmd. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in pom.xml. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/main/java/com/example/es/EsDemoGuangApplication.java. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/test/java/com/example/es/EsDemoGuangApplicationTests.java. The file will have its original line endings in your working directory

この問題の主な理由は、最初にgit cloneを介して他の人のgithubアドレスからダウンロードし、自分のgithubにgit pushしたい場合、上記のエラーメッセージが表示されます。

この時点で、次のコードを実行する必要があります。



git rm -r --cached . git config core.autocrlf false git add .