git 서버의 SSH 프로토콜 주소로 인증하고자 할 때 필요한 SSH 공개키를 만들어 보겠습니다.
$ git clone git@github.com:ggamzzak/test.git
Cloning into 'test'...
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
↑ SSH 공개키가 없다는 이유로 저장소 복사를 거부했습니다.
공개키 생성
$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/ggamzzak/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/ggamzzak/.ssh/id_rsa.
Your public key has been saved in /home/ggamzzak/.ssh/id_rsa.pub.
The key fingerprint is:
11:91:21:d1:61:11:de:0a:8c:43:44:2f:58:63:48:d3 oops@oops4u.com
생성된 키들은 기본적으로 계정 홈디렉토리의 .ssh 디렉토리에 생성됩니다.
다음은 공개키의 내용을 복사하여 git 서버 관리자에게 메일을 보내든, 자신이 관리자라면 알아서 설정합니다;
$ cat ~/.ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAuZISHmxa8FaESJvCK4G2ty1ZNgggFQZWSGIjnk+ZIW/Ho2PmpZhvfGVuK7ahKdcSimoBv4+dXptPnPELAdcHpgyfnsxl623qUEKvAF0MJ2LpaXx7BAoK3IqJyC3VVTz8ZJGLriAbZT04Er8U01B8SZil7yyo+asdfR9ipclUjl+winoWD5smX2yDWInrY1fqis5etEYZLydrzeG19raHwV7JwGrJHMQ0BOQlZs/RXOYQMWyAJmhfBXp4Jiq+SnW3snb3d9f0SOLZJeeyWVmHePvmjRdk/bSfjRRhiQTcbMnREgBZfiWgQGnJqfbyFWvYeoXID3de1eDnoFh7q5jNLw== oops@oops4u.com
git 저장소로부터 복사 재시도 ↓
$ git clone git@github.com:ggamzzak/test.git
Cloning into 'test'...
Enter passphrase for key '/home/ggamzzak/.ssh/id_rsa':
remote: Counting objects: 7, done.
remote: Compressing objects: 100% (4/4), done.
Receiving objects: 100% (7/7), done.
remote: Total 7 (delta 0), reused 5 (delta 0)
WRITTEN BY
- 손가락귀신
정신 못차리면, 벌 받는다.