Github 生成 ssh 密钥

2022-06-26  本文已影响0人  Sun东辉

生成秘钥

ssh-keygen -t rsa -C test@yeah.net

代码参数含义:

Generating public/private rsa key pair.
Enter file in which to save the key (/Users/angela/.ssh/id_rsa): <==密钥文件默认存放位置,按Enter即可
Enter passphrase (empty for no passphrase): <== 输入密钥锁码,或直接按 Enter 留空
Enter same passphrase again:<== 再输入一遍密钥锁码
Your identification has been saved in /Users/angela/.ssh/id_rsa.<== 生成的私钥
Your public key has been saved in /Users/angela/.ssh/id_rsa.pub.<== 生成的公钥
The key fingerprint is:
SHA256:K1qy928tkk1FUuzQtlZK+poeS67vIgPvHw9lQ+KNuZ4 test@yeah.net
The key's randomart image is:
+---[RSA 3072]----+
|.+ . o           |
|o * B            |
| + = =           |
|. B o .          |
|.O.o . .S        |
|o++*  ..oo.      |
|ooB = .o.o       |
|=+ o *.E.        |
|=o. ..=.         |
+----[SHA256]-----+

此时在.ssh目录下得到了两个文件:id_rsa(私有秘钥)和id_rsa.pub(公有密钥)。

将 rsa.pub 中的内容添加至远端 github 仓库中,即可使用 ssh 访问 github。

上一篇下一篇

猜你喜欢

热点阅读