git push报错[email protected]: Permission denied (publickey).

c 复制代码
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
  • 已经使用git config设置邮箱和密码,可以说使用git config --list查看,用ssh-keygen生成密钥x_github_idrsa,并将x_github_idrsa.pub内容复制进github
c 复制代码
Generating public/private rsa key pair.
Enter file in which to save the key (/home/x/.ssh/id_rsa): x_github_idrsa
  • 使用ssh_add报错
c 复制代码
ssh-add ~/.ssh/x_github_idrsa
Could not open a connection to your authentication agent.
正确案例:Identity added:xxxxxx

正确处理方法

https://stackoverflow.com/questions/17846529/could-not-open-a-connection-to-your-authentication-agent

  • 先打开ssh_add,再添加密钥就可以使用git push了
c 复制代码
eval `ssh-agent -s`
ssh-add
ssh-add ~/.ssh/x_github_idrsa

参考文章Git使用出现[email protected]: Permission denied (publickey). 处理https://blog.csdn.net/qq_43768946/article/details/90411154

用一下git push能出这么多问题是没想到的,stackoverflow还是好用
https://stackoverflow.com/questions/13509293/git-fatal-could-not-read-from-remote-repository

实在不行删除.ssh文件夹里的known_hosts,每次连接应该会重新生成,要不删除ssh_key再重新生成复制进github

相关推荐
Bryan_Long1 小时前
Git 命令行操作提交至远程仓库
git·github
muyouking112 小时前
3.Rust + Axum 提取器模式深度剖析
前端·rust·github
小华同学ai3 小时前
15.4K Star!Vercel官方出品,零基础构建企业级AI聊天机器人
github
微臣愚钝3 小时前
git的上传流程
git
lmxnsI3 小时前
git报错
git
三道杠卷胡4 小时前
【AI News | 20250417】每日AI进展
人工智能·pytorch·python·语言模型·github
bulucc4 小时前
回归,git 分支开发操作命令
大数据·git·elasticsearch
岳轩子5 小时前
git更新的bug
git·bug
绝无仅有7 小时前
使用 Docker 安装 Elastic Stack 并重置本地密码
后端·面试·github
uhakadotcom7 小时前
Langflow:零基础快速上手AI流程可视化开发工具详解与实战案例
后端·面试·github