[git오류] git@ Permission denied (publickey)

2022. 2. 24. 16:28Programming/Git

반응형

# 터미널에서 git으로 github 경로를 clone 했을 때 아래와 같이 에러가 발생

$ git clone git@github.com:goodgods/docker-images.git

Cloning into 'docker-images'...
The authenticity of host 'github.com (52.78.231.108)' can't be established.
ECDSA key fingerprint is SHA256:p2QAMXNIC1TJYWrVc98/R1BUu3/LiyUfQM.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'github.com,52.78.231.108' (ECDSA) to the list of known hosts.
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

# 해결

$ ssh-keygen -t rsa -C "email "

Generating public/private rsa key pair.
Enter file in which to save the key (/Users/goodgods/.ssh/id_rsa): => ssh가 설치되는 경로,  [Enter] 누른다.
Enter passphrase (empty for no passphrase): => 암호 설정, 암호를 설정하지 않으려면 그냥 [Enter] 누른다.
Enter same passphrase again: => 암호 again
Your identification has been saved in /Users/goodgods/.ssh/id_rsa.
Your public key has been saved in /Users/goodgods/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:/QA7YAfSjN/wTo+N58yLsPeQdHcubHG7A *****@gmail.com
The key's randomart image is:
+---[RSA 3072]----+
|  .o.=o  .o...   |
|   .+o+o.. o.    |
|    .++.     |
|     +.@S + o    |
|    . o* o  .    |
|     o.o=        |
|    ....o.       |
+----[SHA256]-----+

 

## id_rsa.pub 내용 복사

$ vi /Users/goodgods/.ssh/id_rsa.pub

 

## github 접속 및 로그인

Key값에 ./ssh/id_rsa.pub 파일 내용을 가져온다.

 

## 설치 되었는지 확인 작업

$ ssh -T git@github.com

Hi goodgods! You've successfully authenticated, but GitHub does not provide shell access.

반응형