如何解决git@github.com: Permission denied (publickey)异常

如何解决git@github.com: Permission denied异常

一、错误信息描述

git@github.com: Permission denied (publickey). fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.

原因:

权限被拒绝(公钥)。致命错误:无法从远程存储库读取。请确保您具有正确的访问权限并且存储库存在。

二、解决办法

2.1、获取本地SSH Key

  • 先执行ssh-keygen -t rsa -C 'your-emailXXXX@example.com', 看本地是否存在ssh key
  • 若本地存在,直接执行cat ~/.ssh/id_rsa.pub 获取,执行命令后如下

2.2、将本地的SSH Key添加到github


相关推荐
m0_694845571 小时前
tinylisp 是什么?超轻量 Lisp 解释器编译与运行教程
服务器·开发语言·云计算·github·lisp
June`1 小时前
muduo项目排查错误+测试
linux·c++·github·muduo网络库
春日见2 小时前
如何创建一个PR
运维·开发语言·windows·git·docker·容器
weixin_6684 小时前
GitHub 2026年AI项目详细数据汇总表-AI分析-分享
人工智能·github
CoderJia程序员甲20 小时前
GitHub 热榜项目 - 日榜(2026-02-05)
ai·开源·大模型·github·ai教程
stevenzqzq21 小时前
git 常用操作
大数据·git
weixin_6681 天前
GitHub 2026年AI项目热度分析报告-AI分析-分享
人工智能·github
Curvatureflight1 天前
Git工作流最佳实践:从混乱到优雅
git
MicrosoftReactor1 天前
技术速递|GitHub Copilot CLI 斜杠命令速查表
github·copilot·cli
wu~9701 天前
GitHub永不遗忘,使用git push -f来覆盖的提交依旧保留
git·github