步骤三 配置ssh秘钥
配置git账户
git config --global user.name '你的账户名'
git config --global user.email '你的邮箱'
生成SSH公钥
1.通过命令ssh-keygen 生成 SSH Key:
ssh-keygen -t ed25519 -C "Gitee SSH Key"
-tkey 类型-C注释
注: windows用户ssh秘钥生成后保存在C:\Users\<用户名>\.ssh\目录下
输出,如:
Generating public/private ed25519 key pair.
Enter file in which to save the key (/home/git/.ssh/id_ed25519):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/git/.ssh/id_ed25519
Your public key has been saved in /home/git/.ssh/id_ed25519.pub
The key fingerprint is:
SHA256:ohDd0OK5WG2dx4gST/j35HjvlJlGHvihyY+Msl6IC8I Gitee SSH Key
The key's randomart image is:
+--[ED25519 256]--+
| .o |
| .+oo |
| ...O.o + |
| .= * = +. |
| .o +..S*. + |
|. ...o o..+* * |
|.E. o . ..+.O |
| . . ... o =. |
| ..oo. o.o |
+----[SHA256]-----+
- 中间通过三次回车键确定
2.查看生成的 SSH 公钥和私钥:
找到 ~/.ssh/ 目录
ls ~/.ssh/
输出:
id_ed25519 id_ed25519.pub
- 私钥文件
id_ed25519 - 公钥文件
id_ed25519.pub
3.读取公钥文件 ~/.ssh/id_ed25519.pub:
cat ~/.ssh/id_ed25519.pub
输出,如:
ssh-ed25519 AAAA***5B Gitee SSH Key
添加部署公钥
1.进入用户界面
找到 [安全设置] > [SSH公钥]

2.将id_ed25519.pub的内容复制到指定位置,点击 [确定] 即可 (标题会自动识别)
