본문 바로가기

git

깃허브 Credential 을 활용하여 로그인절차 임시적으로 생략하기

21.03.10 

현재 노트북에서는 gitbash로  push할경우 계정 확인을 하지않지만

데스크탑에선 push할때 계정 확인을 하라는창이 자꾸뜸

 

불편해서 알아보던중 현재까지 임시방법으로 괜찮아보여 포스팅

 

(이방법은 캐시를 저장함으로써 일정시간동안 해당 레포지토리에 대한 인증을 묻지않음)

 

 

1. Credential 정보 저장

#> git config credential.helper store


credential.helper의 store 옵션을 주게되면 해당 git directory에선 반영구적으로 인증 절차가 생략됩니다.(저장된 credential 정보를 이용해 인증 처리)

2. 캐시 저장

#> git config credential.helper cache


임시로 일정 시간동안 저장하기에는 cache 가 더욱 유용합니다. cache 옵션을 주게되면 기본적으로 15분 동안 인증 절차를 요구하지 않습니다.
시간은 timeout 옵션으로 지정해줄 수 있습니다. (초 단위이며 아래와 같이 지정 시 3600초, 즉 1시간의 유효시간을 가집니다)

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

모드 프로젝트에 적용

git config의 공통적인 설정과 같이 --global 옵션을 주게되면 해당 git directory 이외에 모든 git 활동에서 저장된 정보를 이용하게 됩니다.

#> git config credential.helper store --global

 

 

 

Reference

https://git-scm.com/docs/git-credential-cache

 

Git - git-credential-cache Documentation

If you would like the daemon to exit early, forgetting all cached credentials before their timeout, you can issue an exit action: git credential-cache exit

git-scm.com

 

출처 

Git pull/push 시 Password 물어보지 않도록 설정하기(credential.helper) (hahwul.com)