본문 바로가기

IT/etc

[Git] credential.helper

SSH 인증이 어려울 경우, 혹은 username / password로 push 해야할 경우

Git에서 지원하는 credential helper를 활용해보자.


https://help.github.com/articles/caching-your-github-password-in-git/


내 경우 노트북에서의 push를 위해 Mac 부분의 코드를 참고했다.

# 테스트를 위한 커맨드. Usage 관련 메시지가 출력된다면 설치된 것.
# Usage: git credential-osxkeychain <get|store|erase>
$ git credential-osxkeychain

# git 전역에서 credential.helper로 사용하도록 설정값을 잡아준다.
$ git config --global credential.helper osxkeychain

# clone이 아닌 git init 후 최초 push의 경우:
# remote set-url로 저장소의 url을 설정해준 후 push한다.
# 차례로 username과 password를 입력하고 인증될 경우 push가 이루어진다.
$ git remote set-url origin https://github.com/Kitchu0401/react.git
$ git push origin master
Username for 'https://github.com':
Password for 'https://Kitchu0401@github.com':