git 报错:Please make sure you have the correct access rightsand the repository exists 或Permission de

本节内容:

  • 错误原因
  • 解决方案

一.错误原因

  安装完git,想要通过ssh的方式下载,需要本机生成公钥与github上的账号进行验证,绑定,才能从github上通过ssh下载项目

二.解决方案

  进入https://github.com/settings/profile查看自己的账号和邮箱,记下来,下面会用到。

  

 

  打开Git输入命令git config –global user.name “yourname”回车 
          git config –global user.email“your@email.com”回车 

  

   ssh-keygen -t rsa -C “your@email.com”(填写自己的邮箱地址)回车

接下来会出现:(一路回车就可以)

  Generating public/private rsa key pair.
  Enter file in which to save the key (/root/.ssh/id_rsa):

直到出现:

  

  之后打开提示的目录下记事本打开id_rsa.pub,复制里面内容。

  进入自己的账号https://github.com/settings/keys 点击 New sshKey 

  复制的内容粘贴到Key里,Title可以不写,亲测

   

  验证:$ ssh -T git@github.com回车 

  Hi XXXXX! You’ve successfully authenticated, but GitHub does not provide shell access. 

   成功,接下来就可以从github上clone下来项目了。

posted @ 2018-05-29 14:20  最咸的咸鱼  阅读(6813)  评论(0)    收藏  举报