git

git 오류 [ warning: in the working copy of '~~', LF will be replaced by CRLF the next time Git touches it]

mmalmmizal 2023. 7. 20. 16:40

 

git 에서 CRLF 개행 문자 차이로 인한 문제 해결하기

 

Windows  - line ending으로 CR(Carriage-Return, \r)과 LF(Line Feed, \n)을 사용

Unix 나 Mac OS -  LF 만 사용하기 때문에 생기는 문제 

 

 

core.eof

 

git이 line ending을 처리하는 방법에 관한 항목 

 

  •  core.eol = native 기본 설정 (os 시스템에서 line ending을 처리하는 방법에 따름)
  • core.eol = crlf  (crlf를 line ending으로) 
  • core.eol=lf

 

core.autocrlf

text file을 git object database에 적용할 때 어떻게 처리할지 설정하는 변수 

 

  • core.autocrlf=false (기본설정. git은 상관하지 않고 파일 그대로)
  • core.autocrlf=true   (crlf를 lf로 변경함)
  • core.autocrlf=input (lf를 line ending으로 사용함) 

 

 

 

 

해결 방법 

 

os 별로 crlf 차이를 막기 위해 각기 다른 설정을 권장. 

 

window

git config --global core.autocrlf true

 

참고 

git 에서 CRLF 개행 문자 차이로 인한 문제 해결하기 (lesstif.com)

'git' 카테고리의 다른 글

git 실전 사용  (3) 2024.01.09
git 시작하기  (1) 2023.06.29