
Config는 configuration(설정)의 약자이며, git config라는 명령어로 git의 환경설정을 쉽게 할 수 있도록 도움을 준다.
Git의 설정 범위에는 local(지역), global(전역), system(시스템) 이렇게 총 3가지가 있다.
local로 지정하면 해당 컴퓨터의 특정 저장소(repository)에만 적용되는 범위이고,
global로 지정하면 해당 컴퓨터의 특정 사용자에게만 적용되는 범위,
system은 해당 컴퓨터의 모든 사용자와 모든 저장소에 적용된다.
※따로 범위를 정하지 않으면 local값을 기본값으로 가진다.
설정파일의 위치를 알아보겠다.
local은 .git/config
global은 ~/.gitconfig
system은 유닉스:/etc/gitconfig , 윈도우:C:\ProgramData\Git\config다.
설정범위를 정하면 설정범위에 해당하는 파일위치로 파일이 저장이된다.
현재 Git 모든 설정값들을 확인하는 방법
git config --list
git config --l
list전체가 아닌 사용자 이름/이메일만 따로 확인하는 방법
①전역설정확인
git config --global user.name "사용자 이름"
git config --global user.email "이메일"
②지역설정확인
git config --global user.name "사용자 이름"
git config --global user.email "이메일"
사용자 이름/이메일을 등록하는 방법이고, 수정을 원할때도 이것을 사용하면 된다.
①전역설정
git config --global user.name "사용자 이름"
git config --global user.email "이메일"
②지역설정
git config --local user.name "사용자 이름"
git config --local user.email "이메일"
등록했던 사용자 이름/이메일을 삭제하는 방법
1.중복값이 없을때
①전역설정삭제
git config --unset --global user.name "사용자 이름"
git config --unset --global user.email "이메일"
②지역설정삭제
git config --unset --local user.name "사용자 이름"
git config --unset --local user.email "이메일"
2.중복값이 있을때
①전역설정삭제
git config --unset-all --global user.name "사용자 이름"
git config --unset-all --global user.email "이메일"
②지역설정삭제
git config --unset-all --local user.name "사용자 이름"
git config --unset-all --local user.email "이메일"