解决:Permission denied (publickey).fatal: Could not read from remote repository.

github

Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

这个问题的出现主要是 个人SSH key被我从新覆盖了一遍 可是github上面没有添加这个SSH keydom

因此我搜索了网上的解决方法,以下:ssh

在终端输入: ssh-keygen -t rsa -C "AndIMissU"
这条命令的“”里面填写的是本身GitHub的用户名ide

终端出现:

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

按下回车 

终端出现:

/User/****/.ssh/id_rsa already exists.
Overwrite (y/n)? y

输入y 再 回车

终端出现:

Enter passphrase (empty for no passphrase):

按下回车

终端显示:

Enter same passphrase again:

最后回车出现:

Your identification has been saved in /User/****/.ssh/id_rsa.
Your public key has been saved in /User/****/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:7emPWueS2x2NHFIliv2E65vDsO9KLZo5JHwytj8aRQs AndIMissU
The key's randomart image is:
+---[RSA 2048]----+
|              . .|
|           o o o |
|      E . . + o  |
|       o o   =   |
|     .  S . o o  |
|      *.o..+ o + |
|     ..B  *=+ + .|
|      ..oB+*o+ . |
|      .o*+=BO..  |
+----[SHA256]-----+

咱们能够看到 咱们的SSH key就存放在 /User/****/.ssh/id_rsa.pub目录下
而后咱们须要查看一下 SSH key
在终端中输入 cat /User/****/.ssh/id_rsa.pub(这里的cat 后面加的是你本身存放的SSH key 的路径)此时cat 输入之后 出现 你要的SSH key

 

而后:打开GitHub的Settings 添加一个新的SSH key

 

最后一步:复制刚刚cat到的SSH key 添加进入下面的红色框框内 这样咱们就能够正常的push和pull啦

  • 3
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值