话不多说,终端里的代码直接复制过来
Last login: Fri May 17 21:45:31 on ttys000
liuduoduodeMacBook-Air:~ liuxiangyang$ ssh-keygen -t rsa -C 1094435120@qq.com
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/liuxiangyang/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /Users/liuxiangyang/.ssh/id_rsa.
Your public key has been saved in /Users/liuxiangyang/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:fIKTdkyEcf/1BYr2sd2AiM7QA7TyVNqpMNbsnYrnDjg 1094435120@qq.com
The key‘s randomart image is:
+---[RSA 2048]----+
| .+o+ . |
| o.X + o o . |
| = B B = + o .|
| . B % + o = +.|
| O S . + . o|
| . o + o |
| E o o |
| . + |
| .o |
+----[SHA256]-----+
liuduoduodeMacBook-Air:~ liuxiangyang$ cd .ssh
liuduoduodeMacBook-Air:.ssh liuxiangyang$ ls -l
total 16
-rw------- 1 liuxiangyang staff 1823 5 17 21:46 id_rsa
-rw-r--r-- 1 liuxiangyang staff 399 5 17 21:46 id_rsa.pub
liuduoduodeMacBook-Air:.ssh liuxiangyang$ cat id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDHQZmRmesi+f2HmuSyggiUo94vTeAwA1hNsVErejkp37k5sVfsYUimwiWB1n2tdQypQuHShl2Up0KeiGKHv8CGzCyf85E/UC4xYdk0YyOHOZhnC6PKEq3lCejoIZgH2x3rKAVOCUSg/XA1pc4vqjmR8LcUxJ6b4q8njwgHRcPRSE8SbwEePIpWzxcTyWCBFahxBthB02M2vdjSignU8c/g8xaXGJTnekBuzEah4kuGlhSbCYmS6A1pRKp3fFDZ8TzN5/OCfUJriZvoYwAayD4YvQiXDbP0++qSswkQWBD/fJ/0WJJK/7gtO683B8kjaAmZKfUg9YWte/uDtyC2uUAv 1094435120@qq.com
liuduoduodeMacBook-Air:.ssh liuxiangyang$ ssh -T git@github.com
The authenticity of host ‘github.com (13.250.177.223)‘ can‘t be established.
RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
Are you sure you want to continue connecting (yes/no)? y
Please type ‘yes‘ or ‘no‘: yes
Warning: Permanently added ‘github.com,13.250.177.223‘ (RSA) to the list of known hosts.
Hi duoudo! You‘ve successfully authenticated, but GitHub does not provide shell access.
原文:https://www.cnblogs.com/duo-duo/p/10883866.html