D:\代码>ssh-keygen -t rsa -C "your_email@qq.com"
Generating public/private rsa key pair.
# 输入保存秘钥路径
Enter file in which to save the key (C:\Users\administrator/.ssh/id_rsa): C:\Users\administrator/.ssh/id_rsa
# 输入私钥密码
Enter passphrase (empty for no passphrase):
# 确认私钥密码
Enter same passphrase again:
# 成功提示:私钥路径
Your identification has been saved in C:\Users\administrator/.ssh/id_rsa.
# 公钥路径
Your public key has been saved in C:\Users\administrator/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:A/ubTazEs92/nOxQaRNb1yoVTRqgU+cE/wU+2h5PuHk your_email@qq.com
The key's randomart image is:
+---[RSA 2048]----+
| +o+ o |
| o = * . |
| . o . B + .|
| . . o . = B + |
| + + O * o * .|
| . O O + o o * |
| + + + . . + E|
| . = O . |
| .B. |
+----[SHA256]-----+
将公钥提供给对应的网站,比如:https://gitee.com/
添加完公钥后,可以验证一下
D:\代码>ssh -T git@gitee.com
Enter passphrase for key 'C:\Users\administrator/.ssh/id_rsa':
Hi [36;01mzhengzc[0m! You've [32msuccessfully[0m authenticated, but GITEE.COM does not provide shell access.