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

复制终端输出的公钥。

相关推荐
logocode_li23 分钟前
说透 Linux Shell:命令与语法的底层执行逻辑
linux·运维·ssh
猫头虎28 分钟前
OpenClaw-VSCode:在 VS Code 里玩转 OpenClaw,远程管理+SSH 双剑合璧
ide·vscode·开源·ssh·github·aigc·ai编程
hh随便起个名2 小时前
适合小白的git的基础使用方法
git
我会一直在的2 小时前
Devps持续集成
git·ci/cd
宁雨桥2 小时前
Gitee迁移GitHub开源全攻略:一键配置自动同步,仅需维护单一仓库
gitee·开源·github
CoderJia程序员甲3 小时前
GitHub 热榜项目 - 日榜(2026-02-08)
git·ai·开源·llm·github
Serene_Dream4 小时前
git 常用命令
git
jiayong234 小时前
Detached HEAD 状态详解
git
李少兄14 小时前
在 IntelliJ IDEA 中修改 Git 远程仓库地址
java·git·intellij-idea
先跑起来再说20 小时前
Git 入门到实战:一篇搞懂安装、命令、远程仓库与 IDEA 集成
ide·git·后端·elasticsearch·golang·intellij-idea