Permission denied (publickey).fatal: Could not read from remote repository.

2020. 8. 13. 23:06문제들

git을 쓰다보면 간혹 이런게 뜬다.

[root@ip-1-31-15-68 nodejs_app]# git push -u origin master
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

원인 : 해당 환경에 인증키가 없는것

생각해보면 당연하다. 민증 안보고는 술도 안파는 세상인데.

순서대로 따라하면 된다

[ec2-user@ip-2-31-15-68 nodejs_app]$ ssh-keygen
**enter enter enter enter**
[ec2-user@ip-2-31-15-68 nodejs_app]$ cat ~/.ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCwnYUyXemjk9uGs07ufYyyPae1zvd8N1agC8J8C25gh8R1zT9Xmtg1XiqHP8VHy1A5l0y3LgnM3RM8/KNCSV/lklYPlFGbyMVLVbgNzH058AFChpGYxhSc2D3RwnuktOuwyVxPAl7n8sO62DrCIFrizzxW8b5fIkWZ3BqOaS0rUasQUD+vm4idETR/j0QhLGuwgSHhLdNAS+vyIR9qJEiYQhZAuDQFSJIWod6LiaZ9T+DVJecmdp5Y0l85FF3AT9GN1//LGpIV3/sUI4WY+M1FV0i9qHfSFFRmXSy6KCU2e+rtxtGhyxYmQYNddSUND8S10p1KYZOY6I29KI3DupHp ec2-user@ip-172-31-15-68

cat ~/.~~ 을 했을 때 나오는 문구를 고스란히 복사한다. 

github & gitlab에서 setting에 들어가면 ssh keys 항목이 있다. 

붙여넣기하고, 만료기한을 설정하면 된다. 

 

 

긴 글 보기

더보기

[root@ip-172-31-15-68 nodejs_app]# git push -u origin master
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

 

[ec2-user@ip-2-31-15-68 nodejs_app]$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/ec2-user/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/ec2-user/.ssh/id_rsa.
Your public key has been saved in /home/ec2-user/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:B45iVq4Ci0PyGgb52ysqkAkfr2CyOiuIlNiPL1fuWTg ec2-user@ip-172-31-15-68
The key's randomart image is:
+---[RSA 2048]----+
|                        |
|                        |
| . .                     |
| . o o .               | 
|Boo + o S .         
|B@.= o.. .           |
|#o*o+oE .           |
|SBobo .+            |
|X+o+o.o             |
+----[SHA256]-----+
[ec2-user@ip-2-31-15-68 nodejs_app]$ cat ~/.ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCwnYUyXemjk9uGs07ufYyyPae1zvd8N1agC8J8C25gh8R1zT9Xmtg1XiqHP8VHy1A5l0y3LgnM3RM8/KNCSV/lklYPlFGbyMVLVbgNzH058AFChpGYxhSc2D3RwnuktOuwyVxPAl7n8sO62DrCIFrizzxW8b5fIkWZ3BqOaS0rUasQUD+vm4idETR/j0QhLGuwgSHhLdNAS+vyIR9qJEiYQhZAuDQFSJIWod6LiaZ9T+DVJecmdp5Y0l85FF3AT9GN1//LGpIV3/sUI4WY+M1FV0i9qHfSFFRmXSy6KCU2e+rtxtGhyxYmQYNddSUND8S10p1KYZOY6I29KI3DupHp ec2-user@ip-172-31-15-68

 

 

happy하다.