git

git-ssh_key

2. SSH Key 관련

SSH Key 생성

1
$ ssh-keygen -t rsa -C "yourEmail@example.com"
2
Generating public/private rsa key pair.
3
Enter file in which to save the key (/c/Users/yourUserDirectory/.ssh/id_rsa):
4
Created directory '/c/Users/yourUserDirectory/.ssh'.
5
Enter passphrase (empty for no passphrase):
6
Enter same passphrase again:
7
Your identification has been saved in /c/Users/yourUserDirectory/.ssh/id_rsa.
8
Your public key has been saved in /c/Users/yourUserDirectory/.ssh/id_rsa.pub.

SSH Key 생성 결과

1
The key fingerprint is:
2
SHA256:[핑거프린트] yourEmail@example.com
3
The key's randomart image is:
4
+---[RSA 2048]----+
5
|     [생략]      |
6
+----[SHA256]-----+

Github에 공개키 등록

Personal Settings -> SSH and GPG Keys -> New SSH Key -> Key 내용에 id_rsa.pub 내용 복사

공개키 확인

1
$ cat ~/.ssh/id_rsa.pub
2
ssh-rsa [공개키 내용] yourEmail@example.com

동작 확인

1
$ ssh -T git@github.com
2
The authenticity of host 'github.com (192.30.255.113)' can't be established.
3
RSA key fingerprint is SHA256:[핑거프린트].
4
Are you sure you want to continue connecting (yes/no)?
Share