`
jodron
  • 浏览: 21357 次
  • 性别: Icon_minigender_1
  • 来自: 北京
文章分类
社区版块
存档分类
最新评论

git "Could not read from remote repository.Please make sure you have the correct

 
阅读更多
我们在使用git clone 或其他命令的时候,有时候会遇到这类问题,如图:

fatal: Could not read from remote repository.



Please make sure you have the correct access rights

and the repository exists.

fatal: Could not read from remote
repository.Please make sure you
have the correct access rights and the repository exists.

出现这个问题是因为没有在github账号添加SSH key

解决方法如下:
1.在终端输入。

ssh-keygen -t rsa -C "username" (注:username为你git上的用户名)


如果执行成功。返回

Generating public/private rsa key pair.

Enter file in which to save the key (/Users/username/.ssh/id_rsa):

Generating public/private rsa key pair.
Enter file in which to save the key (/Users/username/.ssh/id_rsa):
首先,说明一下,这里的username是你电脑上的用户名

然后,在这里就是设置存储地址了.我们直接按回车,会出现一下两种情况的一种:

(1)如果正常运行的话,会出现

Enter passphrase (empty for no passphrase):

然后我们直接回车

(2)有的时候我们可能会出现

/Users/your username/.ssh/id_rsa already exists.

Overwrite (y/n)?

这说明你已经设置了存储地址,我们输入“y”覆盖

Overwrite (y/n)? y

回车



上面的任意两种情况之后,会出现

Enter same passphrase again:

再次回车,这时候你会看见:

Your identification has been saved in /Users/username/.ssh/id_rsa.

Your public key has been saved in /Users/username/.ssh/id_rsa.pub.

The key fingerprint is:

58:42:8b:58:ad:4b:b5:b9:6d:79:bf:8c:f9:e2:2b:ed
username

The key's randomart image is:

+--[ RSA 2048]----+

|    ...          |

|   o oo.         |

|  . .ooo.        |

|    o o+         |

|   . ..oS.       |

|    . . + .      |

|       . o .     |

|        . o+.    |

|         +E++.   |

+-----------------+


这说明SSH key就已经生成了。文件目录就是:/Users/username/.ssh/id_rsa.pub.

我们执行cat命令查看文件的内容:

cat /User/username/.ssh/id_rsa.pub

这时候会看见:

ssh-rsa AAAAB3NzaC1yc2。。。。。。。。。

后面的内容我省略了
(说明:ssh-rsa 后面的内容这就是你的SSH keys)

把显示出来的SSH
keys直接添加到github账户设置里边的SSH keys

最后再执行git clone命令就可以了

参见原文:http://blog.csdn.net/u014343528/article/details/48787221
分享到:
评论

相关推荐

    Manning.Git.in.Practice.2014.9.pdf

    - **Importing from SVN**: Use `git svn clone` to import an SVN repository into Git. This imports the SVN history and converts it into Git commits. **Chapter 10: GitHub Pull Requests** - **Pull ...

    Git.Version.Control.Cookbook.1782168451

    As you progress through this book, you will learn how you can automate the usual Git processes by utilizing the hook system built into Git. The book also covers advanced repository management, ...

    git安装包git-2.34.0-64-bit.rar

    7. **远程仓库**:Git可以与像GitHub或GitLab这样的远程服务集成,`git remote add origin`命令用于添加远程仓库,`git push -u origin main`将本地分支推送到远程仓库。 8. **图形化界面**:虽然Git主要是命令行...

    Git.Mastering.Version.Control.pdf

    As you progress on to the next module, you will learn how you can automate the usual Git processes by utilizing the hook system built into Git. It also covers advanced repository management, including...

    repository.zip

    4. **Git基础**:Git的基本操作包括初始化仓库(`git init`)、添加文件到暂存区(`git add`)、提交更改(`git commit`)、创建分支(`git branch`)、合并分支(`git merge`)以及与其他仓库同步(`git pull`和`git push`)。...

    git源码压缩包v2.42.0

    Git的核心概念主要包括仓库(Repository)、提交(Commit)、分支(Branch)、合并(Merge)和远程仓库(Remote Repository)。仓库是Git中存储项目所有版本的地方,而提交则是对代码更改的记录,每个提交都有一个...

    Git.Best.Practices.Guide.1783553731

    This book is invaluable to anyone who wants a thorough reference guide to go back to every time they have questions about any feature of Git. Table of Contents Chapter 1. Starting a Git Repository ...

    Git-2.21.0-64-bit.zip

    from in the local repository and in the published repository are different. * When creating a partial clone, the object filtering criteria is recorded for the origin of the clone, but this ...

    Learn.Git.in.a.Month.of.Lunches.1617

    Learn Git in a Month of Lunches introduces the discipline of source code control using Git. Helpful for both newbies who have never used source control and busy pros, this book concentrates on the ...

    Git-2.28.0-64-bit.exeGit-2.28.0-64-bit.exe

    Git-2.28.0-64-bit.exe Git-2.28.0-64-bit.exe Git-2.28.0-64-bit.exe

    git最新版下载(Git-2.14.1-64-bit.exe)

    git下载,上传百度云吧

    离线安装git-1.8.3--centos7.6.1810

    在IT行业中,版本控制工具Git是开发者们必不可少的利器,特别是在协作开发中,它能有效管理代码版本,便于团队成员间协同工作。本教程将详细讲解如何在CentOS 7.6.1810系统上离线安装Git 1.8.3。 首先,我们需要...

    git 视频教程

    git视频教程.1.Git 命令 - git help、git config.mp4 git视频教程.2.Git 命令 - git init、git clone.mp4 git视频教程.3.1.Git 命令 - git add、git status.mp4 git视频教程.3.2.Git 命令 - git diff、git difftool....

    解决fatal:remote error:You can’t push to git://github.com/username/*.git问题的办法

    解决fatal:remote error:You can’t push to git://github.com/username/*.git问题的办法 今天Git push的时候 fatal:remote error: You can't push to git://github.com/username/*.git Use git@github....

    Git-2.38-64位安装及说明

    5. **追踪远程分支**:`git remote add origin <repository-url>`关联远程仓库,`git fetch`获取远程数据,`git merge`或`git rebase`合并远程分支。 6. **推送和拉取**:`git push origin <branchname>`将本地分支...

    Git-2.25.1-64-bit.rar

    Git的常用命令包括`git init`(初始化一个新的仓库)、`git clone`(复制远程仓库)、`git add`(暂存更改)、`git commit`(保存更改)、`git push`(上传本地更改至远程仓库)、`git pull`(获取并合并远程仓库的...

    git-2.34.8.tar.gz

    6. 远程仓库(Remote Repository):团队成员共享代码的中央存储库,通常托管在GitHub、GitLab或Bitbucket等服务上。 7. 克隆(Clone):创建远程仓库的本地副本。 8. 拉取(Pull):从远程仓库获取最新的更改并合并...

    Git安装包,2.35.1.2版本,windows64位

    - **Path配置**:确保勾选“Run Git from the Windows Command Prompt”以便在命令行中使用Git。 4. **完成安装**:按照提示完成安装过程。 **四、Git基本操作** 1. **初始化仓库**:在本地目录下,通过`git ...

Global site tag (gtag.js) - Google Analytics