git连接github mac
话不多说,终端里的代码直接复制过来
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
(此处显示的是id_rsa.pub里的内容,),把此处的内容全部复制到GitHub->右上角点击头像->settings->SSH and GPG keys->New SSH key->title填写你的注册邮箱->key为复制的内容(需要注意的是id_rsa.pub文件在.ssh文件夹下)
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.