首先要创建两个ssh key
ssh-keygen -t rsa -C "xxx@163.com"
如果你之前已经生成过ssh key的话执行上面的指令会报错
Generating public/private rsa key pair.
//默认的输出文件就是根目录下的.ssh/id_rsa 你需要重新指定一个文件名
//如:.ssh/id_rsa_emal1 文件名如何定义自行决定
Enter file in which to save the key (/Users/111/.ssh/id_rsa):
//这里要重新指定一个文件名,注意路径是相对路径,不然容易找不到生成的文件
下面就是正常的生成ssh key 的过程,
//设置密码,这步可以跳过
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /Users/111/.ssh/id_rsa_test.
Your public key has been saved in /Users/111/.ssh/id_rsa_test.pub.
The key fingerprint is:
SHA256:xxxxxxxxxxxxxxxxxxxxxxx
xxx@163.com
The key's randomart image is:
+---[RSA 2048]----+
| . |
| + |
| + O . |
| . * & = . |
| = X O S . |
| + B * * . |
| . o * * . . E|
| . + o +.. o.|
| .o o+=. +|
+----[SHA256]-----+
这样新的ssh key 就生成好了