配置gitee的密钥

生成 SSH 公钥

Windows 用户建议使用 Windows PowerShell 或者 Git Bash,在 命令提示符 下无 cat 和 ls 命令。

1、通过命令 ssh-keygen 生成 SSH Key:

ssh-keygen -t ed25519 -C "Gitee SSH Key"

-t key 类型
-C 注释

haonan@haonan-vm:~/shared$ ssh-keygen -t ed25519 -C "Gitee SSH Key"
Generating public/private ed25519 key pair.
Enter file in which to save the key (/home/haonan/.ssh/id_ed25519): 
Created directory '/home/haonan/.ssh'.
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /home/haonan/.ssh/id_ed25519
Your public key has been saved in /home/haonan/.ssh/id_ed25519.pub
The key fingerprint is:
SHA256:m+AOH992GJWPqxGTEnkL7xyqn7Xkkh6yS+P2tqD486E Gitee SSH Key
The key's randomart image is:
+--[ED25519 256]--+
|                 |
|         .       |
|        + .  .   |
|         = oo    |
|      . S B. o   |
|     . . B.+. .  |
|    . O =.*o .   |
|   ..O.X+Booo    |
|  ..E+O*B+=o     |
+----[SHA256]-----+

  • 中间通过三次回车键确定

2、查看生成的 SSH 公钥和私钥:

haonan@haonan-vm:~/shared$ ls ~/.ssh/
id_ed25519  id_ed25519.pub

输出:

id_ed25519  id_ed25519.pub

私钥文件 id_ed25519
公钥文件 id_ed25519.pub
读取公钥文件 ~/.ssh/id_ed25519.pub:

cat ~/.ssh/id_ed25519.pub

输出,如:

ssh-ed25519 AAAA***5B Gitee SSH Key

复制终端输出的公钥。
最终配置gitee参考链接:https://help.gitee.com/base/account/SSH%E5%85%AC%E9%92%A5%E8%AE%BE%E7%BD%AE

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值