Permission denied (publickey)

Permission denied (publickey)

问题

问题描述 :

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

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

原因

电脑上的公钥没有添加到 GitHub 上 .

解决

## 设置 username
15099@DESKTOP-PI12QV5 MINGW64 ~/Desktop
$ git config --global user.name "lifanyu"

## 设置 email
15099@DESKTOP-PI12QV5 MINGW64 ~/Desktop
$ git config --global user.email "1509984575@qq.com"

## 如果有该文件夹删除如果没有就会出现如下提示
15099@DESKTOP-PI12QV5 MINGW64 ~/Desktop
$ cd ~/.ssh
bash: cd: /c/Users/15099/.ssh: No such file or directory

## 生成 SSH 密钥
15099@DESKTOP-PI12QV5 MINGW64 ~/Desktop
$ ssh-keygen -t rsa -C "1509984575@qq.com"
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/15099/.ssh/id_rsa):
Created directory '/c/Users/15099/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /c/Users/15099/.ssh/id_rsa.
Your public key has been saved in /c/Users/15099/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:ZFV7w2Bi5jchANze9CRMB/Rk95LwwtSORB423blvsYQ 1509984575@qq.com
The key's randomart image is:
+---[RSA 2048]----+
|     ..o.=X+/o...|
|      . .=+&o@o+.|
|       .oo.=OoO o|
|       o. ..oE.* |
|        S     . +|
|               .o|
|               . |
|                 |
|                 |
+----[SHA256]-----+

## 切换到 .ssh 目录
15099@DESKTOP-PI12QV5 MINGW64 ~/Desktop
$ cd ~/.ssh

## 查看目录中的文件
15099@DESKTOP-PI12QV5 MINGW64 ~/.ssh
$ ls
id_rsa  id_rsa.pub

## 打开 id_rsa.pub 文件
15099@DESKTOP-PI12QV5 MINGW64 ~/.ssh
$ vim id_rsa.pub

##内容为 :(自己 id_rsa.pub 中的内容)
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDIS0KMOhGlje9usos/lvjqgnRd6miZ1/su/fStgMD65eLAVE1C6FCiowRmLu52UjhNnqhIjRbw4CTCECb7JViuGzLfFb+eq+hD0NQgr/qUuIF3ENrclRMpu63NyhfuB1nDDTTrCd1sHyd1dNReZ8uqwiFckTnJx 15099875@qq.com
id_rsa.pub [unix] (21:02 30/07/2019)                                  

将 id_rsa.pub 中的内容拷贝到 GitHub 上的 settings -> ssh and gpg keys -> new ssh key

在这里插入图片描述

在这里插入图片描述

再次 push 就成功了 .

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值