Linux

git config setting / store credential

mark340 2023. 9. 23. 13:00

git config란, git에 대한 설정 정보이다.


  • git 전체 config 리스트 보기
git config --global --list
  • git config 설정하기 (이름, 이메일)
git config --global user.name "이름"
git config --global user.email "이메일"

-> global : 전역적인 설정

  • git config 삭제하기
git config --unset --global user.name
git config --unset --global user.email

 

 

 

Credential.helper - Cache


id, password를 짧은 시간동안 반복적으로 입력하는 일을 피할 때 사용

git config --global credential.helper cache

-> 위의 'git config --global --list'를 입력해보면 'credential.helper=cache'라고 리스트에 추가된다.

-> 한 번 cache를 하면 15분동안 메모리에서 유지하는데, 시간을 연장하려면 다음의 명령어를 입력한다.

 

git config credential.helper 'cache --timeout=3600'

-> 위와 같이 설정해두면 3600초, 즉 1시간동안 캐싱을 한다.

 

 

 

 

Credential.helper - Store


id, password를 Disk에 저장하고 유지하고싶은 경우에 사용

git config --global credential.helper store

-> 위의 'git config --global --list'를 입력해보면 'credential.helper=store'라고 리스트에 추가된다.

-> 한 번 로그인된 정보는 자동으로 저장되며 다음부터 묻지 않게 된다.

-> 저장된 로그인 정보는 ~/.git-credentials 경로에 저장된다.