Git: autocrlf 설정: 개행문자

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

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

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

https://yoongrammer.tistory.com/m/32?category=942106

core.autocrlf : newline관련 설정.

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

  • core.autocrlf = false (default)
    • 파일 내용을 그대로 반영.
    • 비추천
  • core.autocrlf = true
    • git repository에 업로드(push) 할 때, 모든 개행문자를 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의 내용 그대로 반영.

참고: CR(Carriage Return)과 LF(Line Feed) (velog.io)

 

CR(Carriage Return)과 LF(Line Feed)

CR(Carriage Return), LF(Line Feed)의 정의 컴퓨터에서 CR(Carriage Return, 이하 CR)과 LF(Line Feed, 이하 LF)는 줄바꿈 방식을 뜻한다. | 방식 | 설명 | 이스케이프 문자 | | --- | -

velog.io

 


권장 설정.

# 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

 

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

https://dsaint31.tistory.com/568

 

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

왜 필요한가?Windows/DOS 의 경우 개행을 CRLF(Carriage return \r + Line feed \n)로 지정함.Linux/Unix/macOS 의 경우 개행을 Linefeed(LF \n)로 사용. 윈도우에서 편집한 소스코드를 linux등에서 git 등으로 가져온 후 편

dsaint31.tistory.com


 

728x90

'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
  • 전체
    오늘
    어제
    • 분류 전체보기 (787)
      • Private Life (15)
      • Programming (206)
        • DIP (116)
        • ML (35)
      • Computer (120)
        • CE (54)
        • ETC (33)
        • CUDA (3)
        • Blog, Markdown, Latex (4)
        • Linux (9)
      • ... (368)
        • Signals and Systems (115)
        • Math (176)
        • Linear Algebra (33)
        • Physics (43)
        • 인성세미나 (1)
      • 정리필요. (61)
        • 의료기기의 이해 (6)
        • PET, MRI and so on. (7)
        • PET Study 2009 (1)
        • 방사선 장해방호 (5)
        • 방사선 생물학 (3)
        • 방사선 계측 (9)
        • 기타 방사능관련 (3)
        • 고시 (9)
        • 정리 (18)
      • RI (0)
      • 원자력,방사능 관련법 (2)
  • 블로그 메뉴

    • Math
    • Programming
    • SS
    • DIP
  • 링크

    • Convex Optimization For All
  • 공지사항

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

  • 태그

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

  • 최근 글

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

티스토리툴바