맥과 윈도우를 번갈아서 사용할 때
윈도우에서 작성한 파일을 맥에서 수정하는 경우 한 글자만 변경하더라도 파일의 모든 부분이 변경되었다고 표시되었다.

OS마다 줄 끝을 처리하는 방식이 달라서 생기는 문제였는데.

git config core.autocrlf

위 설정을 통해 깃이 줄 끝을 자동으로 처리하도록 설정할 수 있다.

 

맥/리눅스의 경우 autocrlf를  input 구성으로 설정하면 문제가 해결된다.

$ git config --global core.autocrlf input
# Configure Git to ensure line endings in files you checkout are correct for macOS

이러면 깃이 알아서 줄 끝을 맞춰준다

 

아니면 윈도우에서 autocrlf를 true로 설정하면 된다.

$ git config --global core.autocrlf true
# Configure Git to ensure line endings in files you checkout are correct for Windows.
# For compatibility, line endings are converted to Unix style when you commit files.

autocrlf를 true로 설정하면 애초에 줄 끝을 유닉스 스타일로 맞춰줘
맥이나 리눅스에서도 호환성 문제 없이 작업할 수 있다.

 

https://docs.github.com/en/get-started/getting-started-with-git/configuring-git-to-handle-line-endings

 

Configuring Git to handle line endings - GitHub Docs

About line endings Every time you press return on your keyboard you insert an invisible character called a line ending. Different operating systems handle line endings differently. When you're collaborating on projects with Git and GitHub, Git might produc

docs.github.com

 

 

'프로그래밍' 카테고리의 다른 글

모든 질문에 답을 해주는 사이트  (0) 2017.10.16
블로그 이미지

stuban

ㅇ.ㅇ

,