[Github] SSH 열쇠 등록하기
그물터 관리/웹 서버
2024/08/11 11:44
Github에 SSH 열쇠(SSH key)를 미처 등록하지 않은 채로 리눅스에서 git 작업을 하려고 하면 아래와 같은 오류가 나올 수 있다.
# git push
The authenticity of host 'github.com (20.200.245.247)' can't be established.
ED25519 key fingerprint is SHA256:+PiY3wvvV6….
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'github.com' (ED25519) to the list of known hosts.
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
SSH 열쇠를 Github에 등록하려면, SSH and GPG keys(https://github.com/settings/keys)로 들어간다.

이미 등록된 SSH 열쇠가 있으면 위 화면처럼 목록이 나올 것이다. 'New SSH Key'를 눌러서 SSH 열쇠를 넣는 화면(Add new SSH Key)으로 들어간다.

Title(제목)에는 열쇠(key)의 종류나 쓰임새를 쓰는 사람이 알아보기 좋게 넣어 준다.
Key 값에는 공개 열쇠(public key) 값을 넣어 준다. (리눅스 서버의 /계정 경로/.ssh/id_rsa.pub에 들어간 ssh-rsa 열쇠값을 넣으면, 리눅스 서버에서 Github에 바로 접근하여 작업할 수 있다.)
이렇게 하고 'Add SSH key'를 누르면 SSH 열쇠가 새로 등록된다.
덧글을 달아 주세요