首页 / GIT / git@github.com: Permission denied (publickey). fatal: Could not read from remote repository 解决方法
git@github.com: Permission denied (publickey). fatal: Could not read from remote repository 解决方法
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了git@github.com: Permission denied (publickey). fatal: Could not read from remote repository 解决方法,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含1204字,纯文字阅读大概需要2分钟。
内容图文
![git@github.com: Permission denied (publickey). fatal: Could not read from remote repository 解决方法](/upload/InfoBanner/zyjiaocheng/1290/709238aaa29441b8a0fef03c24314309.jpg)
问题描述:
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.
原因:
大概率是秘钥设置不对的问题
首先检查有没有在GitHub的https://github.com/settings/keys上添加你本机的SSH key。注意换了电脑是要重新添加的,每台都不一样。添加SSH key的方法:(引自廖雪峰老师的教程)
-
创建SSH Key。在用户主目录下,看看有没有.ssh目录,如果有,再看看这个目录下有没有
id_rsa
和id_rsa.pub
这两个文件,如果已经有了,可直接跳到下一步。如果没有,打开Shell(Windows下打开Git Bash),创建SSH Key:$ ssh-keygen -t rsa -C "youremail@example.com"
你需要把邮件地址换成你自己的邮件地址,然后一路回车,使用默认值即可,由于这个Key也不是用于军事目的,所以也无需设置密码。
如果一切顺利的话,可以在用户主目录里找到
.ssh
目录,里面有id_rsa
和id_rsa.pub
两个文件,这两个就是SSH Key的秘钥对,id_rsa
是私钥,不能泄露出去,id_rsa.pub
是公钥,可以放心地告诉任何人。 -
登陆GitHub,打开“Account settings”,“SSH Keys”页面:
然后,点“Add SSH Key”,填上任意Title,在Key文本框里粘贴
id_rsa.pub
文件的内容:点“Add Key”,你就应该看到已经添加的Key:
解决方法:
? 如果添加了还是出现这个问题,那么问题大概率就定位在了你本机的这个git仓库并没有和这个SSH key 关联上。用下述方法解决:
ssh-add "你的 id-rsa 文件地址"
# 注意这里ssh-add后面填的是私钥地址,如mac电脑是 /Users/用户名/.ssh/id_rsa
ssh -T git@github.com
Hi chenyangdeng! You‘ve successfully authenticated, but GitHub does not provide shell access.
#验证是不是添加成功
原文:https://www.cnblogs.com/xxyang/p/13751249.html
内容总结
以上是互联网集市为您收集整理的git@github.com: Permission denied (publickey). fatal: Could not read from remote repository 解决方法全部内容,希望文章能够帮你解决git@github.com: Permission denied (publickey). fatal: Could not read from remote repository 解决方法所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。