ubuntu获得sshkey的方法:
1.打开终端命令行。
2.输入以下命令。
ssh-keygen -t rsa -C "your_email@example.com" //your_email@example.com为你在GitHub还是GitLab注册时的邮箱
2.履行后,终端会显示以下结果,按回车保存。
Created directory '/Users/xxx/.ssh'.
Enter passphrase (empty for no passphrase):
3.提示设置 passphrase,设置成功后会显示:
Your identification has been saved in /Users/xxx/.ssh/id_rsa.
Your public key has been saved in /Users/xxx/.ssh/id_rsa.pub.
The key fingerprint is:
16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48 your_email@example.com
The key's randomart image is:
心形图形
4.接着在终端输入以下命令:
ssh-add ~/.ssh/id_rsa
5.按要求填刚刚设置的passphrase,成功后会显示:
Identity added: /Users/xxx/.ssh/id_rsa (/Users/xxx/.ssh/id_rsa)
6.最后再输入以下命令就能够获得你的sshkey了,命令以下:
cat /Users/xxx/.ssh/id_rsa.pub
本文来源:https://www.yuntue.com/post/75425.html | 云服务器网,转载请注明出处!

微信扫一扫打赏
支付宝扫一扫打赏