- 检测下自己之前有没有配置
git config user.name git config user.email -
如果之前没有创建,则执行以下命令:
git config --global user.name ‘xxxxx’ git config --global user.email ‘xxx@xx.xxx’ # 查看配置 git config --global --list -
生成秘钥
#代码参数含义: #-t 指定密钥类型,默认是 rsa ,可以省略。 #-C 设置注释文字,比如邮箱。 #-f 指定密钥文件存储文件名。 ssh-keygen -t rsa -C '上面的邮箱' - 接着按3个回车
[root@localhost ~]# ssh-keygen -t rsa <== 建立密钥对,-t代表类型,有RSA和DSA两种 Generating public/private rsa key pair. Enter file in which to save the key (/root/.ssh/id_rsa): <==密钥文件默认存放位置,按Enter即可 Created directory '/root/.ssh'. Enter passphrase (empty for no passphrase): <== 输入密钥锁码,或直接按 Enter 留空 Enter same passphrase again: <== 再输入一遍密钥锁码 Your identification has been saved in /root/.ssh/id_rsa. <== 生成的私钥 Your public key has been saved in /root/.ssh/id_rsa.pub. <== 生成的公钥 The key fingerprint is: SHA256:K1qy928tkk1FUuzQtlZK+poeS67vIgPvHw9lQ+KNuZ4 root@localhost.localdomain The key's randomart image is: +---[RSA 2048]----+ | +. | | o * . | | . .O + | | . *. * | | S =+ | | . =... | | .oo =+o+ | | ==o+B*o. | | oo.=EXO. | +----[SHA256]-----+ - 登录GitHub,进入你的Settings

- 粘贴你的密钥到你key输入框中

Github 创建ssh秘钥
于 2021-09-24 11:13:40 首次发布
本文介绍如何配置Git用户名及邮箱,并生成SSH密钥用于安全地连接GitHub仓库。
742

被折叠的 条评论
为什么被折叠?



