Git Config 설정 및 변경하기

정말 매번 기억이 나지 않는 git config 설정에 대해서 정리해두려고 한다.

 

git config 설정을 해두지 않으면 github repository 에 push 또는 pull 하는 과정에서 매번 토큰을 입력해주어야 하는 번거로움이 있어 인증 정보를 캐시로 한 번만 설정해 두게 되면 토큰을 입력하지 않아도 자동으로 인증이 되기 때문에 설정을 해주어야 한다.

 

Git 설정 확인

git config --list

 

Git 계정 설정하기

전역 설정

git config --global user.name {username}
git config --global user.email {email}

로컬 설정 (Repository 마다 다른 계정을 사용할 경우)

git config --local user.name {username}
git config --loacl user.email {email}

 

Git 계정 삭제하기

전역 계정 삭제

git config --unset --global user.name
git config --unset --global user.email

로컬 계정 삭제

git config --unset user.name
git config --unset user.email

 

Git 인증 정보 저장 및 캐시

인증 정보 캐시에 저장

git config --global credential.helper cache

인증 정보를 영구 저장하기

git config --global credential.helper store

 

Git 인증 정보 제거하기

git config --global --unset credential.helper