zoukankan      html  css  js  c++  java
  • git "Could not read from remote repository.Please make sure you have the correct access rights."解决方案

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

     

    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 (/root/.ssh/id_rsa): 

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

    (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: 

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

     

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

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

    cat /root/.ssh/id_rsa.pub

    这时候会看见:

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

    后面的内容我省略了

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

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

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

     
  • 相关阅读:
    rpm软件包以及rmp命令
    使用ssh-keygen生成密钥对
    从现有的虚拟机创建vagrant box ,再利用新创建的box创建虚拟机
    EXCEL固定行和列
    URL编码
    标准ASCII码
    base64编码
    http学习--URL字符
    浏览器通过http获取服务器资源的过程
    一名程序员过去10年的程序员生涯,给程序员小弟弟小妹妹们的一些总结性忠告
  • 原文地址:https://www.cnblogs.com/ESHLkangi/p/8204329.html
Copyright © 2011-2022 走看看