카테고리 없음

[Git] 설정 기본 문법

Sh-YE 2024. 9. 16. 17:43

System Config

시스템 모든 사용자와 모든 저장소에 적용

git config --system

 

Global Config

시스탬의 특정 사용자에게 적용

git config --global

 

Local Config

특정 저장소에 적용

git config --local

 

User Name & Email

- Git 서버에 공유와 배포할때 마다 참고하는 유저이름과 이메일

git config user.name <user_name>
git congig user.email <email_address>

 

CRLF (End of Line)

줄바꿈 문자를 말한다

- Window에서는 CR (\r) + LF (\n) 모두 사용

- Unix or Max LF (\n)만 사용

 

※ 서로 다른 OS에서 함께 Git으로 작업한다면 core.autocrlf = true 사용

core.autocrlf = false

- 파일에 적용된 줄바꿈 문자와 상관없이 작업한 환경의 줄바꿈 문자를 적용함.

core.autocrlf = true

-  파일에 적용된 줄바꿈 문자를 CRLF에서 LF로 변경한다.

core.autocrlf = input

-  Commit할때만 CRLF를 LF로 변경한다.

 

Editor

git config core.editor <editor_name>

# editor를 vscode로 설정예시
git config --global core.editor code

 

 Default Branch

git config init.defaultBranch <branch_name>

 

Git 전체 설정확인

git config --l
git config --list

 

Git 범위별 설정확인

git config --l --show-origin
git config --list --show-origin

 

Git 항목별 설정확인

git config <key>

# 항목별 설정확인 예시
git config user.name