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


相关推荐
__zRainy__10 分钟前
VS Code 自动同步如何重写 Git 历史:一次重复合并冲突的排查与恢复
git
Alex6630281 小时前
我重写了 Hermes Agent,专门修掉了它的 4 个硬伤
github
IT码农-爱吃辣条1 小时前
AI Codeview 安装与使用教程
git·ai
考虑考虑2 小时前
git中的tag
git·gitlab·github
REDcker3 小时前
Git浅克隆详解与实践
大数据·git
小墨同学boy3 小时前
WorkBuddy零基础教程进阶篇
人工智能·github·aigc
BerrySen1783 小时前
GitHub开源项目破圈方法论:从技术自嗨到生态共赢
开源·github
养肥胖虎12 小时前
Git提交规范笔记:feat和fix到底该怎么写
git·conventionalcommits
手握风云-13 小时前
深入 Git:它是如何记录世界的(二)
git
JavaGuide20 小时前
一个神级 PR Review Agent 诞生了:读 diff、写总结、找风险全自动!
github·ai编程