git & github 공부 기록/🙈 git 오류

LF will be replaced by CRLF the next time Git touches it

stop-zero 2023. 3. 29. 00:58

문제: add 하려고 했는데

in the working copy of 'package.json', LF will be replaced by CRLF the next time Git touches it

package.json의 복사본이 있다고 합니다..깃이 다음에 그것을 건드릴 LF(unix줄바꿈)은 CRLF(window줄바꿈)으로 대체할 것이다...? 

자세히 해석하자면 LF(Line-Feed)는 unix계열의 줄바꿈 문자열이고, CRLF는 Windows의 줄바꿈 문자열이다. 

 

원인 : OS마다 줄바꿈을 보는 문자열이 다르기에 git은 어느 쪽을 택해야할지 모르고 경고 메시지를 띄운다. 


 

해결 : 간단하게  자동 변환해주는 core.autocrlf 기능 켜주기!

git config --global core.autocrlf true

 

잘못된 명령어로 반복되는 문제🤣

근데 또 문제가 생겼는데 매번 json 파일 생성할 때마다 반복되었다. 😂

git config --global core.autocrlf false 로 설정해야 한다고 한다. 

 
 

Reference


https://dabo-dev.tistory.com/13

 

[Git 경고 메세지] LF will be replaced by CRLF in 해결 방안

안녕하세요(・∀・)ゞ Git을 설치하고 GitBash에서 git add 명령어를 입력했는데 git add bora.txt warning: LF will be replaced by CRLF in bora.txt. The file will have its original line endings in your working directory 다음과같

dabo-dev.tistory.com