bug解决:Permission denied (publickey). fatal: Could not read from remote repository;SSH key添加方法

(base) [ec2-user@ip- workspace]$ git clone [email protected]:hamigua2019/minerl.git
Cloning into 'minerl'...
Permission denied (publickey).
fatal: Could not read from remote repository.

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

(base) [ec2-user@ip-workspace]$ ~/.ssh ls
bash: /home/ec2-user/.ssh: Is a directory
(base) [ec2-user@ip- workspace]$
(base) [ec2-user@ip- workspace]$ ssh-keygen -t rsa -C "[email protected]"
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:Wc4st+v84QJaRQs17JGgV1HCQyMifpVtUoJEL9jMpHY [email protected]
The key's randomart image is:
+---[RSA 2048]----+
|    .o=.=XX+.    |
|   . O.=++X+     |
|    = E o*.+     |
|   . o o *+      |
|        S.=      |
|        oo .     |
|       o .. .    |
|      .  ..o .   |
|         .+oo    |
+----[SHA256]-----+
(base) [ec2-user@ip- workspace]$ cd ~/.ssh
(base) [[email protected]]$ ls
authorized_keys  id_rsa  id_rsa.pub  known_hosts
(base) [ec2-user@ip- .ssh]$ cat id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDJ8d5dLZd+i1U+nzZGpsT0l8/VEY0OfYljT+ohR8mGxBDBPtPcP+Tsaj+Q2xVLZsmU2lwGQC7NE/1t208yf+I51isW0dHEQgBGV2x/5kYClapFPiiKehMK0lMWhS7X7pZfu9vssDnRyaURHeW916igu61NOS5Vbnr3WHSgQLcle0bil9Q+WEb5FLvrGuF00ou6dMEQMm70ZA0eZF3h0hrUpx883nWM8J9j9e6PgegUMrzF6wsqURhnr9stp+THSbKdLBpqqCj9kpP9Z2k/YVlsDhG18pCe48URr9ERHw93CfRxuvTV9Cu2MAJDMw8cOfMP7sOvfhogZPIutB7JE4Xh [email protected]
(base) [ec2-user@ip- .ssh]$ ssh -T [email protected]
Hi hamigua2019! You've successfully authenticated, but GitHub does not provide shell access.
(base) [[email protected]]$

参考文章:
https://www.cnblogs.com/h-c-g/p/10768088.html
https://blog.csdn.net/qq_36667170/article/details/79094257

你可能感兴趣的:(ssh,linux)