当前位置: 首页 > news >正文

配置SSH密钥统一推送Github和Gitee

1. 为 Github 生成 SSH 密钥

ssh-keygen -t ed25519 -C "your_email@example.com" -f ~/.ssh/id_ed_github

将 id_ed_github.pub 添加到 Github SSH keys中。Settings -> Access ->SSH and GPG keys -> New SSH keys

参考:Gitehub 生成新的 SSH 密钥并将其添加到 ssh-agent

2. 为 Gitee 生成 SSH 密钥

ssh-keygen -t ed25519 -C "your_gitee_email@example.com" -f ~/.ssh/id_ed_gitee

将 id_ed_gitee.pub 添加到 Gitee SSH 公钥中。设置 -> 安全设置 -> SSH 公钥

参考:Gitee SSH 公钥设置

3. 配置 SSH 的 config 文件

# Github
Host github.comHostName github.comPort 22User gitPreferredAuthentications publickeyIdentityFile ~/.ssh/id_ed_githubIdentitiesOnly yes# Gitee
Host gitee.comHostName gitee.comPort 22User gitPreferredAuthentications publickeyIdentityFile ~/.ssh/id_ed_giteeIdentitiesOnly yes

4. 测试

出现 You've successfully authenticated,表示成功。

# 测试 Github
ssh -T git@github.com
The authenticity of host 'github.com (20.205.243.166)' can't be established.
ED25519 key fingerprint is SHA256:+DiY3wvvV6TuJJhbpZisF/zLDA0zPMSvHdkr4UvCOqU.
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'github.com' (ED25519) to the list of known hosts.
Hi geyashi! You've successfully authenticated, but GitHub does not provide shell access# 测试 Gitee
ssh -T git@gitee.com
The authenticity of host 'gitee.com (180.76.199.13)' can't be established.
ED25519 key fingerprint is SHA256:+ULzij2u99B9eWYFTw1Q4ErYG/aepHLbu96PAUCoV88.
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'gitee.com' (ED25519) to the list of known hosts.
Hi weiweqi(***)! You've successfully authenticated, but GITEE.COM does not provide shell access.
http://www.rkmt.cn/news/57473.html

相关文章:

  • 2025 最新网袋厂家实力推荐排行榜:全品类定制方案 + 前沿技术应用深度盘点,采购必看水果/尼龙/大葱/白菜/椰枣/水产/地瓜网袋公司推荐
  • 2026凉山州一对一家教机构推荐,五大辅导机构口碑排名已更新,附本地家长真实反馈评价!
  • 2025年景观绿雕植物源头厂家权威推荐榜单:植物雕塑/景观雕塑/仿真绿雕源头供应商精选
  • 2025 最新淮北外科医院推荐!外科医院口碑排行榜权威发布,二级医院资质 + 100 张床位,实力之选全解析
  • 2025 最新推荐网眼袋源头厂家权威榜单:全新原料精准编织 + 无中间环节,高性价比品牌测评指南蔬菜/洋葱/土豆/水果/尼龙网眼袋公司推荐
  • 2025年减速机定做厂家权威推荐榜单:伺服减速机/精密减速机/人形减速机定制厂家精选
  • HBase大数据存储如何提升读写性能
  • BOM和DOM
  • 2025高粱酒纯粮食酒推荐TOP10,纯粮固态发酵酱香浓郁回甘绵长
  • 玉树州一对一家教机构最新推荐,2026最新家教机构榜单:家长首选靠谱提分方案推荐
  • 2025年拉袋离心机订制厂家权威推荐榜单:碟式离心机/卧螺离心机/活塞推料离心机源头厂家精选
  • hbase上如何导入python包
  • Git为什么要有submodule呢?
  • 打印机字体漏洞分析:CVE-2024-12649技术深度解析
  • java freemarker(ftl)模板填充导出PDF,支持中文乱码
  • 2025 最新仿石漆厂家权威推荐榜:真石漆 / 绿色环保仿石漆优质品牌精选仿石漆/真石漆/绿色真石漆/有资质的仿石漆公司推荐
  • 2025年纱线烘干机制造厂权威推荐榜单:气流烘干机/筒子烘干机/快速烘干机源头制造厂精选
  • CF1630C Paint the Middle
  • P3113 [USACO14DEC] Marathon G
  • 崖山数据库导出 - 华
  • AI Compass前沿速览:Nano Banana Pro、Gemini 3 、 HunyuanVideo 1.5 、Meta SAM 3D生成
  • MX Round 27 解题报告
  • 11.22模拟赛
  • 2025年镀锌水沟盖板订做厂家权威推荐榜单:雨水沟盖板/污水沟盖板/镀锌排水沟盖板源头厂家精选
  • 使用C# Channel实现工位流水线调度系统
  • BLOG1-NCHU-单部电梯调度程序
  • web漏洞、waf繞過和前端加密繞過
  • 2025年水肥一体机制造厂权威推荐榜单:便携式水肥一体机/全自动喷淋系统/简易水肥一体源头厂家精选
  • Java—抽象类 - 实践
  • 英语_阅读_AI models_待读