解决git@github.com: Permission denied (publickey). fatal: Could not read from remote repository. Pleas

简介: 解决git@github.com: Permission denied (publickey). fatal: Could not read from remote repository. Pleas

今天用idea提交代码到github上,push后报错

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.


一:原因分析


Permission denied (publickey) 没有权限的publickey ,出现这错误一般是以下两种原因


客户端与服务端未生成 ssh key

客户端与服务端的ssh key不匹配

找到问题的原因了,解决办法也就有了,重新生成一次ssh key ,服务端也重新配置一次即可。


二:客户端生成ssh key


在cmd里面输入


ssh-keygen -t rsa -C "xxxxxxxx@qq.com"


ssh-keygen -t rsa -C "youremail@example.com"

xxxxxx@qq.com改为自己的邮箱即可,途中会让你输入密码啥的,不需要管,一路回车即可,会生成你的ssh key。(如果重新生成的话会覆盖之前的ssh key。)

 

三:输入箭头处路径



 

四:打开id_rsa.pub文件,并且复制内容



配置服务端


五:在github上打开箭头处,点击Setting



六:点击SSH and GPG keys


 


七:打开你刚刚生成的id_rsa.pub,将里面的内容复制,进入你的github账号,在settings下,SSH and GPG keys下new SSH key,然后将id_rsa.pub里的内容复制到Key中,完成后Add SSH Key。




八:然后添加后入下图所示



 

 

九:用idea再次提交文件到 github上,显示提交成功


相关文章
|
10月前
|
网络协议 开发工具 git
解决 git 报错 “fatal: unable to access ‘https://github.com/.../.git‘: Recv failure Connection was rese
在使用 Git/Git小乌龟 进行代码管理的过程中,经常会遇到各种各样的问题,其中之一就是在执行 git clone 或 git pull 等操作时出现 “fatal: unable to access ‘https://github.com/…/.git’: Recv failure Connection was reset” 的报错。这个问题通常是由网络连接问题或代理设置不正确导致的。在我的个人使用经验中,我亲自尝试了四种方法,它们都能够有效地解决这个报错。个人比较推荐方法二。
7155 1
|
网络安全 开发工具 git
mac git clone命令提示git@gitee.com: Permission denied (publickey).问题修复
mac git clone命令拉取gitee上项目代码时提示密钥问题
1179 19
|
网络安全 开发工具 git
解决fatal:remote error:You can’t push to git://github.com/username/*.g
通过上述诊断与修复步骤,绝大多数的推送错误都能得到有效解决,确保您的Git工作流顺畅无阻。
723 1
|
Unix Shell 网络安全
git学习六:(bug总结)git@github.com: Permission denied (publickey).等
本文是关于解决在使用Git和GitHub时遇到的“git@github.com: Permission denied (publickey)”错误的指南。文章提供了详细的步骤,包括确认SSH Agent运行状态、检查密钥配置、确保密钥匹配、验证仓库URL、检查权限和代理设置,以及配置SSH文件。这些步骤帮助用户诊断并解决SSH认证问题。
2829 0
|
Shell 网络安全 开发工具
fatal: unable to access 'https://github.com/wolfcw/libfaketime.git/': Encountered end of file
fatal: unable to access 'https://github.com/wolfcw/libfaketime.git/': Encountered end of file
【完美解决】Github action报错remote: Write access to repository not granted.
【完美解决】Github action报错remote: Write access to repository not granted.
|
存储 开发工具 数据安全/隐私保护
解决Gitee或者Github出现Access denied fatal: unable to access,The requested URL returned error: 403
解决Gitee或者Github出现Access denied fatal: unable to access,The requested URL returned error: 403
7076 0
|
开发工具 git 开发者
Git与Github两者的区别|学习笔记
快速学习Git与Github两者的区别
258 0
|
开发工具 git CDN
Git与GitHub学习笔记(五)一次提交失败的记录
代码已经跟踪了,添加注释说明,但是总是添加不了 error: pathspec 'live-page'' did not match any file(s) known to git. 重复了好多遍,最后发现代码还是没有提交 D:\wamp64\www\study-line>git commi...
1862 0
|
开发工具 git
Git与GitHub学习笔记(四)合并远程分支
在这里的前提: 1、你已经fork 源作者的项目到你自己的仓库了 2、git clone 自己仓库fork的项目,注意地址,这里是自己的账号下的地址,而不是源作者的项目地址哦 3、在本地修改代码,git push origin master 提交到自己的主分支(自定义别的分支),  提交一个新的...
1153 0