SSH 公钥设置

Gitee 提供了基于 SSH 协议的 Git 服务,在使用 SSH 协议访问仓库仓库之前,需要先配置好账户 SSH 公钥。

生成 SSH 公钥

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

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

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

  • -t key 类型
  • -C 注释

输出,如:

复制代码
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]-----+
  • 中间通过三次回车键确定
  1. 查看生成的 SSH 公钥和私钥:

    ls ~/.ssh/

输出:

复制代码
id_ed25519  id_ed25519.pub
  • 私钥文件 id_ed25519
  • 公钥文件 id_ed25519.pub
  1. 读取公钥文件 ~/.ssh/id_ed25519.pub

    cat ~/.ssh/id_ed25519.pub

输出,如:

复制代码
ssh-ed25519 AAAA***5B Gitee SSH Key

复制终端输出的公钥。

相关推荐
longerxin20202 小时前
在 Linux 上使用 SCP 将文件传输到 Windows(已开启 SSH)
linux·运维·ssh
JinBeen5 小时前
sourcetree下码云gitee的ssh经常失效问题
android·gitee·ssh
吳所畏惧5 小时前
Linux环境/麒麟V10SP3下离线安装Redis、修改默认密码并设置Redis开机自启动
linux·运维·服务器·redis·中间件·架构·ssh
小龙11 小时前
[Git 报错解决]本地分支落后于远程分支(`non-fast-forward`)
大数据·git·elasticsearch·github
爱敲代码的婷婷婷.12 小时前
git 指定版本回退、临时保存 等操作
git
闲云一鹤13 小时前
Git 焚决!一个绝招助你找回丢失的代码文件!
前端·git
DKunYu13 小时前
2.分支管理
大数据·git·elasticsearch·搜索引擎·gitee
DKunYu14 小时前
1.基本操作
git·gitee
东北小狐狸-Hellxz14 小时前
解决java客户端连接ssh失败问题
java·网络·ssh
小龙14 小时前
【Git 报错解决】SSH 公钥认证失败(`Permission denied (publickey)`)
运维·git·ssh