git clone出现fatal: Could not read from remote repository解决办法

这篇具有很好参考价值的文章主要介绍了git clone出现fatal: Could not read from remote repository解决办法。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

一、问题描述

在git clone一个项目时出现如下报错:
(第一个选项,问你是否继续连接?输入yes然后回车)

The authenticity of host 'github.com (20.205.243.166)' can't be established.
ECDSA key fingerprint is SHA256:p2QAMXNIC1TJYWeIOttrVc98/R1BUFWu3/LiyKgUfQM.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'github.com,20.205.243.166' (ECDSA) to the list of known hosts.
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

通过报错信息可以看出,这是因为Github上没有本机的公钥导致的。

二、解决办法

1、在终端输入

ssh-keygen -t rsa -C "lycbuaacs@163.com"

其中双引号中填自己Github注册账号用的邮箱地址。
点击回车,看到提示

Generating public/private rsa key pair.
Enter file in which to save the key (/home/yichen/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /home/yichen/.ssh/id_rsa
Your public key has been saved in /home/yichen/.ssh/id_rsa.pub
The key fingerprint is:
SHA256:KfhnvKTaASEb6Efb0LKofhCnu6rLgBX72FC3gRykSQU lycbuaacs@163.com
The key's randomart image is:
+---[RSA 3072]----+
|  E++            |
| o +.o           |
|. *+=.o          |
|..oO*+ o .       |
| oO+o.o S        |
|o+.= o o         |
|+ + o o =        |
|+. . . * .       |
|*=o ..o .        |
+----[SHA256]-----+

说明:前三个冒号分别让你输入保存公钥的文件、一次性密钥和密钥确认,可以直接回车,他会默认创建密钥文件到指定路径下。看到如上图所示的乱码,说明公钥创建完成。

2、到路径下查看

我的路径是/home/yichen/.ssh/id_rsa.pub,(注意是后缀为.pub的文件,而不是id_rsa)
cat 显示文件内容,

cat /home/yichen/.ssh/id_rsa.pub

文件形式为

ssh-rsa 后面一堆字符

复制文件里的全部内容(包括前缀ssh-rsa)。

3、打开GitHub

点击右上角自己头像,打开下拉菜单,选择设置Settings
git clone出现fatal: Could not read from remote repository解决办法
左边找到SSH和PGP密钥,点击new SSH Key,将之前复制的内容粘贴到里面,就行了。
git clone出现fatal: Could not read from remote repository解决办法Title栏可以不填,密钥类型选择Authentication Key。
git clone出现fatal: Could not read from remote repository解决办法
然后GitHub让你确认登录,确认登录后就大功告成,可以正常Git Clone了。文章来源地址https://www.toymoban.com/news/detail-413680.html

到了这里,关于git clone出现fatal: Could not read from remote repository解决办法的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • git克隆报错:Permission denied (publickey).fatal: Could not read from remote repository解决办法

    Permission denied (publickey).fatal: Could not read from remote repository 1、问题解决首先参考文章 例如:缺少公钥解决办法 2、生成公钥报错 ssh-keygen -t rsa -C ‘邮箱’ 生成公钥时,报错如下: 解决办法: 需要换到C盘的C:UsersASUS.ssh目录下,再右键Git Bash Here 输入命令: ssh-keygen -t rsa -C \\\'

    2024年02月04日
    浏览(49)
  • 解决git@github.com:Permission denied (publickey).fatal:Could not read from remote repository.

    1.打开Git Bash。 2.输入 ls -al ~/.ssh 以查看是否存在现有 SSH 密钥。 3.检查目录列表以查看您是否已有公共 SSH 密钥。默认情况下,GitHub 支持的公钥的文件名是以下之一: id_rsa.pub、 id_ecdsa.pub、 id_ed25519.pub。 如果您收到 ~/.ssh 不存在的错误,则说明您在默认位置中没有现有的 SS

    2024年02月12日
    浏览(48)
  • git问题:git@github.com: Permission denied (publickey). fatal: Could not read from remote repository.

    重装系统后,git 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.出现这个问题表示你在尝试将本地代码推送到GitHub时,没有提供正确的公钥,或者你的公钥没有被添加到你的GitHu

    2024年02月21日
    浏览(44)
  • 解决GIT问题:git@gitee.com: Permission denied (publickey).fatal: Could not read from remote repository.

    下图是详细的报错信息: 对于这个问题,我们得针对不同的情况来分析,逐步解决这个问题 如果您是刚开始使用git,并且没有生成公钥,我们需要先使用命令来生成公钥 为了更加易懂,给大家额外补充一些SSH的知识 SSH key 的作用: 实现本地仓库和 Github 之间免登录的加密数据

    2024年02月20日
    浏览(46)
  • 【已解决】git clone 报错:Could not read from remote repository. Please make sure you have the correct acce

    换电脑了,克隆代码遇到报错: 找到本地公钥,复制到添加 SSH 公钥处,遇到报错: 官方提出的解决办法:添加 SSH Keys 报已存在怎么办? 按照官方的提示,大概率是原因1,只能重新生成了 但是现在本地这个 SSH Key 在其他地方有使用(Gitee/Github/…),想要保留,再生成一个。

    2024年02月10日
    浏览(41)
  • Permission denied (publickey). fatal: Could not read from remote repository.

    将本地代码推送到远程分支报错:Permission denied (publickey). fatal: Could not read from remote repository. 确保已经添加了正确的 SSH 密钥。可以使用以下命令检查 SSH 密钥是否已经添加: 如果看到消息 “Hi [username]! You\\\'ve successfully authenticated, but GitHub does not provide shell access.” ,则表示已成

    2023年04月18日
    浏览(32)
  • IDEA Git 报错could not read from remote repository

    Git:could not read from remote repository。 首先再git后台,检查是否有对应工程的权限 1  检查idea工程project目录下的.git文件夹下的.config文件,origin配置是否正确 打开.config文件,url有两种方式:https的方式、ssh的方式, 检查对应的url是否正确 2 如果正确,请配置ssh 密钥,网上随便

    2024年02月08日
    浏览(36)
  • git pull 报错 could not read from remote repository解决

    git pull 报错 remote: Your account has been blocked. fatal: could not read from remote repository。一般是SSH的形式clone的仓库,权限被更改了。 如下步骤解决: 重新 生成 gitLabKey 并应用:                  step 1:     使用命令 ssh-keygen -t rsa -b 2048 -C \\\"lvl@svtc.com\\\"                  step 2:     出现

    2024年02月16日
    浏览(30)
  • 解决git@github.com: Permission denied (publickey). Could not read from remote repository

    原因分析 Permission denied (publickey) 没有权限的publickey ,出现这错误一般是以下两种原因 客户端与服务端未生成 ssh key 客户端与服务端的ssh key不匹配 找到问题的原因了,解决办法也就有了,重新生成一次ssh key ,服务端也重新配置一次即可。 客户端生成ssh key 470812087@qq.com改为

    2024年02月04日
    浏览(56)
  • 解决git@github.com:Permission denied (publickey). Could not read from remote repository. Please make s

    这个错误通常表示没有正确的权限来访问该 Git 仓库。 为了解决GitHub上的权限问题,需要执行以下步骤: 打开命令行终端(例如Git Bash)并输入以下命令: 将公钥添加到GitHub帐户中, 执行以下步骤: 在“Title”字段中为新密钥提供一个描述性标题。 将“Key”字段中的公钥粘

    2024年02月06日
    浏览(42)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包