2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

git add .したら『warning: LF will be replaced by CRLF in ~』がズラズラ出てきた場合の対処方法

Last updated at Posted at 2021-02-24

初投稿です。
Qiitaはよく閲覧しますが、投稿したことはありません。
この度、「開発で自分が困った事は他の方も困っているに違いない」という観点から、自分の備忘録も兼ねて投稿することにしました。
不備はあるかもしれませんが、暖かく見守ってください。

さて、本題です。

git initでリポジトリを作成して、初回のステージングを行う際に、下記のようなエラーがズラズラ出てきました。

The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in common/PHPExcel/Writer/OpenDocument/Content.php.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in common/PHPExcel/Writer/OpenDocument/Meta.php.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in common/PHPExcel/Writer/OpenDocument/MetaInf.php.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in common/PHPExcel/Writer/OpenDocument/Mimetype.php.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in common/PHPExcel/Writer/OpenDocument/Settings.php.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in common/PHPExcel/Writer/OpenDocument/Styles.php.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in common/PHPExcel/Writer/OpenDocument/Thumbnails.php.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in common/PHPExcel/Writer/OpenDocument/WriterPart.php.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in common/PHPExcel/Writer/PDF.php.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in common/PHPExcel/Writer/PDF/Core.php.
The file will have its original line endings in your working directory

これは、Gitが自動的にLF改行コードをCRLFに変換した際に出るwarningですので、自動変換をオフにします。
git configで設定します。

$ git config --global core.autoCRLF false

これでwarningは出なくなりました。以上です。

参考:https://kmizukix.hatenadiary.org/entry/20100106/1262711140

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?