Git: autocrlf 설정: 개행문자

2021. 9. 11. 18:41·Computer/ETC
728x90
728x90

Git: autocrlf 설정: 개행문자(new line)

core.autocrlf :
git에서 파일을 git repository 에 업로드할 때
개행문자(new line)를 처리하는 option.

core.autocrlf : newline관련 설정.

core.autocrlf 는 다음과 같은 세가지 mode를 지원.

  • core.autocrlf = false (default)
    • 파일 내용을 그대로 반영.
  • core.autocrlf = true
    • git repository에 업로드 할 때, 모든 개행문자를 LF(line feed, linux와 mac에서의 new line)로 변경.
    • 단, local로 체크아웃할 때는 LF를 CRLF(carriage return + line feed, windows에서의 new line)로 변경.
  • core.autocrlf = input
    • git repository에 업로드시 CRLF가 있으면 LF로 변경.
    • local로 체크아웃할 때는 git repository의 내용 그대로 반영.

권장 설정.

# Windows
$ git config --global core.autocrlf true

# Linux, MacOS
$ git config --global core.autocrlf input

Windows의 git에서는 true로,
Linux or MacOS 에서는 input으로 설정하면
큰 문제가 없을 것으로 보임.


참고자료

보다 자세한 자료.

https://code.visualstudio.com/docs/remote/troubleshooting#_resolving-git-line-ending-issues-in-containers-resulting-in-many-modified-files

 

Visual Studio Code Remote Development Troubleshooting Tips and Tricks

Visual Studio Code Remote Development troubleshooting tips and tricks for SSH, Containers, and the Windows Subsystem for Linux (WSL)

code.visualstudio.com

 

개별 파일에서 문제가 생긴 경우 해결법.

https://dsaint31.tistory.com/entry/vim-VI-carriage-return-%EC%A0%9C%EA%B1%B0%ED%95%98%EA%B8%B0-CRLF-%E2%86%92-LF

 

[vim] VI : carriage return 제거하기 : CRLF → LF

왜 필요한가? Windows/DOS 의 경우 개행을 CRLF(Carriage return + Line feed)로 지정함. Linux/Unix 의 경우 개행을 LF로 사용. git등으로 윈도우에서 편집한 소스코드에 문제가 생기는 경우 발생. ^M (carriage return)

dsaint31.tistory.com

 

'Computer > ETC' 카테고리의 다른 글

iVim : iPad용 vi editor  (0) 2021.09.13
gruvbox 설치 : Retro groove color scheme for Vim  (0) 2021.09.11
Windows 11 미리설치와 카카오톡  (0) 2021.09.06
핵실드에러  (0) 2009.12.20
BM_WDC_HDD_1TB  (0) 2009.10.26
'Computer/ETC' 카테고리의 다른 글
  • iVim : iPad용 vi editor
  • gruvbox 설치 : Retro groove color scheme for Vim
  • Windows 11 미리설치와 카카오톡
  • 핵실드에러
dsaint31x
dsaint31x
    반응형
    250x250
  • dsaint31x
    Dsaint31's blog
    dsaint31x
  • 전체
    오늘
    어제
    • 분류 전체보기 (740)
      • Private Life (13)
      • Programming (56)
        • DIP (104)
        • ML (26)
      • Computer (119)
        • CE (53)
        • ETC (33)
        • CUDA (3)
        • Blog, Markdown, Latex (4)
        • Linux (9)
      • ... (351)
        • Signals and Systems (103)
        • Math (172)
        • Linear Algebra (33)
        • Physics (42)
        • 인성세미나 (1)
      • 정리필요. (54)
        • 의료기기의 이해 (6)
        • PET, MRI and so on. (1)
        • PET Study 2009 (1)
        • 방사선 장해방호 (4)
        • 방사선 생물학 (3)
        • 방사선 계측 (9)
        • 기타 방사능관련 (3)
        • 고시 (9)
        • 정리 (18)
      • RI (0)
      • 원자력,방사능 관련법 (2)
  • 블로그 메뉴

    • Math
    • Programming
    • SS
    • DIP
  • 링크

    • Convex Optimization For All
  • 공지사항

    • Test
    • PET Study 2009
    • 기타 방사능관련.
  • 인기 글

  • 태그

    Term
    SIGNAL
    numpy
    random
    검사
    인허가제도
    signal_and_system
    Probability
    math
    Python
    Vector
    SS
    Programming
    Convolution
    Optimization
    signals_and_systems
    function
    opencv
    linear algebra
    fourier transform
  • 최근 댓글

  • 최근 글

  • hELLO· Designed By정상우.v4.10.3
dsaint31x
Git: autocrlf 설정: 개행문자
상단으로

티스토리툴바