mac 打开终端,输入命令:
ls ~/.ssh
如果存在 id_rsa id_rsa.pub两个文件 ,说明已经有SSH Key了,打开 id_rsa.pub 里面的内容就是我们需要的SSH Key。
如果不存在,输入命令:
ssh-keygen -t rsa -C "youremail@example.com" //输入你的邮箱
终端输出:
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/userName/.ssh/id_rsa):
直接键入回车:
Enter passphrase (empty for no passphrase):
再次键入回车:
Enter same passphrase again:
再回车:
+---[RSA 2048]----+
| o+E|
| o.+*=|
| ..=.=.|
| .o.oo..|
| S +..o.oo|
| o o+ B =|
| o +=.* *.|
| . =o =o= o|
| o. o.oo+ |
+----[SHA256]-----+
标志已经成功生成SSH key
找到 ~/.ssh 目录下的id_rsa.pub并打开,里面的内容就是我们需要的SSH Key.