如何解决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


相关推荐
相与还4 小时前
IDEA和GIT实现cherry pick拣选部分变更到新分支
git·elasticsearch·intellij-idea
Moonbit8 小时前
月报 Vol.04 : 新增 async test 与 async fn main 语法,新增 lexmatch 表达式
后端·github·编程语言
逛逛GitHub9 小时前
发现 4 个贼好玩的 GitHub 项目,相当给劲儿。
github
悟能不能悟10 小时前
用cmd命令修改适配器ip
网络·tcp/ip·github
刘志辉11 小时前
git指令
git
whysqwhw11 小时前
kuiklyui core-ksp ios
github
whysqwhw11 小时前
kuiklyui core-ksp 鸿蒙
github
CoderJia程序员甲11 小时前
GitHub 热榜项目 - 日榜(2025-10-12)
ai·github·开源项目·github热榜
whysqwhw11 小时前
kuikly core-ksp 安卓
github
Tfly__12 小时前
Ubuntu 20.04 安装Aerial Gym Simulator - 基于 Gym 的无人机强化学习仿真器
linux·人工智能·ubuntu·github·无人机·强化学习·运动规划