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

复制终端输出的公钥。

相关推荐
Unity粉末状在校生8 小时前
Git解决fatal: Could not read from remote repository.的问题
git
少年攻城狮9 小时前
Obsidian系列---【如何使用obsidian同步到git?】
git
为何创造硅基生物9 小时前
ESP32 IDF 编译时出现gitee 登录,导致编译报错
gitee
do better myself11 小时前
网站源码如何部署和加入GIT仓库的
git
爱学英语的程序员14 小时前
Git 提交 LF will be replaced by CRLF the next time Git touches it 报错
git
qq_3391911415 小时前
服务器git pull每次都要输入密码,linux 设置git登录,linux设置git只输入一次账户密码
git
一颗小行星!21 小时前
快速理解 Git submodule
git
Zhu7581 天前
【软件更新】在Ubuntu24 LTS中更新openssl到指定版本,例如openssl3.5.6 LTS
linux·ssh·ssl
有理想的打工人1 天前
gitlab群组管理与ssh链接
ssh·gitlab
A-Jie-Y1 天前
Git基础-核心概念与常用命令
git