회사에서 organization 에 대해 personal access token 기반 인증을 막아서, SSH 기반 인증을 사용하기로 했다.
그 이유로는
WebStorm(및 JetBrains IDE 제품군)사용자를 위한 SSH로 GitHub 연동하는 방법을 소개한다.
Generating a new SSH key and adding it to the ssh-agent
깃헙 문서를 따라, SSH 키를 만든다.
Adding a new SSH key to your GitHub account
깃헙 문서를 따라, SSH 키를 깃헙 계정에 등록한다.
터미널을 이용해 레포지토리를 SSH를 이용해 클론하거나, git remote origin 의 주소를 SSH로 변경해준다.
# 클론하거나
$ git clone git@github.com:저장소.git
# 기존 remote/origin를 갱신하거나
$ git remote remove origin
$ git remote add origin git@github.com:저장소.git
터미널에서 SSH를 이용해 GitHub 과 통신을 한번 한다.
$ git fetch origin
# host 'github.com' 에 대한 인증을 확인할 수 없다고 뜬다.
# 그래도 연결할 것인지 물어본다.
# The authenticity of host 'github.com (IP주소)' can't be established.
# ED25519 key fingerprint is SHA256:어쩌고저쩌고.
# This key is not known by any other names
# Are you sure you want to continue connecting (yes/no/[fingerprint])?
# yes 를 치면 'github.com' 를 알려진 호스트에 영구적으로 등록한다.
# Warning: Permanently added 'github.com' (ED25519) to the list of known hosts.
# passpharase 를 설정했다면, 물어본다.
# Enter passphrase for key '비밀 키 경로':
# passphrase를 입력하면 끝!
WebStorm Git 도구에서도 fetch를 하면, passphrase를 입력하라는 창이 뜬다. 입력하면 WebStorm 연동 끝!