前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Permission denied (publickey). fatal: Could not read from remote repository. Please make sure you ha

Permission denied (publickey). fatal: Could not read from remote repository. Please make sure you ha

作者头像
全栈程序员站长
发布2022-07-11 13:02:55
1.8K0
发布2022-07-11 13:02:55
举报
文章被收录于专栏:全栈程序员必看

大家好,又见面了,我是全栈君。

之前使用git进行push或者clone操作的时候出现如下错误:

代码语言:javascript
复制
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

原因:电脑公钥(publickey)未添加至github,所以无法识别。 因而需要获取本地电脑公钥,然后登录github账号,添加公钥至github就OK了。

设置Git的user nameemail

代码语言:javascript
复制
git config --global user.name "yourname"
git config --global user.email "youremail" 

生成SSH密钥

查看是否已经有了ssh密钥:cd ~/.ssh 如果没有密钥则不会有此文件夹,有则备份删除 生存密钥: ssh-keygen -t rsa -C “youremail” 按3个回车,密码为空。 Your identification has been saved in /home/tekkub/.ssh/id_rsa.Your public key has been saved in /home/tekkub/.ssh/id_rsa.pub.The key fingerprint is: ……………… 最后得到了两个文件:id_rsaid_rsa.pub

在github上添加ssh密钥,这要添加的是“id_rsa.pub”里面的公钥。打开github在设置中添加密钥

Permission denied (publickey). fatal: Could not read from remote repository. Please make sure you ha
Permission denied (publickey). fatal: Could not read from remote repository. Please make sure you ha

按照指令操作会进入vim编辑模式,上边的序列码即为公钥,复制序列码,包含(ssh-rsa等标识)。不同操作系统和电脑可能公钥路径不一样,以实际情况为准. 登录github后,进入个人设置settings—>ssh and gpg keys–>new ssh key 添加即可。title自行命名

Permission denied (publickey). fatal: Could not read from remote repository. Please make sure you ha
Permission denied (publickey). fatal: Could not read from remote repository. Please make sure you ha

add ssh key成功后,github就可以识别你的机器,允许你从github拉取代码了。

发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/112046.html原文链接:https://javaforall.cn

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2022年2月1,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档