如何生成 SSH keys, 并在 Github 或 Gitlab 等上添加密钥

1 打开 Git Bash

$ 

2 输入 dir, 确认当前文件夹,并切换到想存密钥文件即pub文件的路径

$ dir

3 生成 密钥命令

ssh-keygen -t rsa -C "{ your email}"

4 按提示输入密钥文件名 和 密码(需输2次)

Enter file in which to save the key( /c/Users/{your pc name}/.ssh/id_sa):
Enter passphrase (empty for no passphrase):
Enter sasme passphrase again:

5 系统提示生成成功

Your identification has been saved in ***.
Your public key has been saved in ***.pub
The key fingerprint is:
.............
The key's randomart image is:
.............

6 打开你生成的pub文件,拷贝里面字符串,粘贴到Github或Gitlab等的如下区域,点击【Add SSH key】,大功告成

 

posted @ 2018-05-30 12:07  jason_xiao  阅读(408)  评论(0编辑  收藏  举报