git을 사용할 때 원격 저장소에 push
하는 등 접근할 때 아이디와 비번(또는 토큰)이 필요한데요, 기본적으로 git은 입력했던 아이디와 비밀번호를 저장하지 않아 매번 repository에 접근할 때마다 아이디와 비밀번호(또는 토큰)를 요구합니다.
$ git push
Username for '<https://github.com>': John
Password for '<https://[email protected]>':
#...
$ git push
Username for '<https://github.com>': John
Password for '<https://[email protected]>':
#(반복)
그래서 git은 1.7.9 버전 이후 부터 credential 정보를 손쉽게 캐싱해주는 credential helper 옵션을 제공합니다. 기본값으로는 credential helper 가 설정되지 않아 매번 인증정보를 입력해 주어야 하는데, 메모리나 디스크, 맥이라면 키체인(osxkeychain)에 인증정보를 캐싱하도록 설정해보겠습니다.
리눅스 기반 OS에서는 다음과 같이 커맨드를 입력해줍니다.
$ git config --global credential.helper cache
# or
$ git config --global credential.helper "cache --timeout=3600"
윈도우용 깃에서도 설정이 가능한데요, wincred 는 더 이상 유지보수가 되지 않으니 Git Credential Manager for Windows를 사용하는 것을 추천한다고 합니다.
$ git config --global credential.helper wincred # 구식
$ git config --global credential.helper manager