解决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上,显示提交成功


相关文章
|
3天前
|
存储 开发工具 git
【Git】Git提示Another git process seems to be running in this repository, e.g. an editor opened by ..错误
【Git】Git提示Another git process seems to be running in this repository, e.g. an editor opened by ..错误
9 0
|
27天前
|
开发工具 git
【已解决】error: failed to push some refs to ‘git@github.com:BATdalao/Github-green.git‘
【已解决】error: failed to push some refs to ‘git@github.com:BATdalao/Github-green.git‘
25 1
|
1月前
|
开发工具 git
git error 已解决【Another git process seems to be running in this repository, e.g. an editor opened by】
git error 已解决【Another git process seems to be running in this repository, e.g. an editor opened by】
24 2
|
8月前
|
网络安全 开发工具 git
git clone之报错git@gitee.com:Permission denied (publickey).fatal: Could not read from remote repository
git clone之报错git@gitee.com:Permission denied (publickey).fatal: Could not read from remote repository
298 0
|
2月前
【Error】fatal: unable to access ‘https://github.com/PanJiaChen/vue-element-admin/‘: OpenSSL SSL_read:
【Error】fatal: unable to access ‘https://github.com/PanJiaChen/vue-element-admin/‘: OpenSSL SSL_read:
|
7月前
|
开发工具 git
解决:fatal: not a git repository (or any of the parent directories): .git的问题
解决:fatal: not a git repository (or any of the parent directories): .git的问题
|
26天前
|
存储 网络安全 开发工具
【GIT】Git常用命令学习
【GIT】Git常用命令学习
32 1
|
2月前
|
Shell 网络安全 开发工具
GIT常用命令
GIT常用命令
|
6天前
|
开发工具 git
GIT日常命令收集
这些命令是GIT日常操作中常用的,但GIT的功能远不止这些,更多高级功能需要通过学习和实践来掌握。
8 0
|
7天前
|
开发工具 git
GIT日常命令收集
这些命令是GIT日常操作中常用的,但GIT的功能远不止这些,更多高级功能需要通过学习和实践来掌握。
11 0