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

复制终端输出的公钥。

相关推荐
柒号华仔16 分钟前
「速通Shell」聚砖成墙,Shell函数封装之道
linux·ssh·bash
整点bug4 小时前
AI 运维该不该自动执行命令?
运维·ssh·openai
cakeism8255 小时前
信创产业与国产替代:政策框架、产业进展与研发基础设施实践
gitee
互联网中的一颗神经元8 小时前
ZZ — Git 速查表
大数据·git·elasticsearch
进击的码力8 小时前
win11 使用ssh 遇到权限too open 无法登录服务器的问题
运维·服务器·ssh
早安试言9 小时前
git使用
git
燐妤9 小时前
梦绘片场 ProjectDream故事总纲场景剧本篇:从项目到成片的 AI 漫剧工作台
人工智能·git·ai·项目开发
JackieDYH18 小时前
Git 与 GitHub 新电脑配置指南(从零开始)
git·github·工具·使用教程
麦芽糖02191 天前
本地已有项目首次上传到gitee
gitee
Jeanyia1 天前
GitLab 配套 Git 常用命令
git·gitlab