将心比心,方得人心~

git clone 报错:“git@github.com: Permission denied (publickey). fatal: Could not read from remote repository.”的解决方案

周洲 2020-06-30 16:52:07

git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
Failed during: git fetch origin master:refs/remotes/origin/master --tags --force

导致原因:秘钥没有设置或设置不正确。

解决方案:重新设置密钥。

第一步:创建SSH Key:

运行cmd输入命令:ssh-keygen -t rsa -C "youremail@example.com",youremail@example.com是你的git邮箱地址。接着一路回车即可。打开cmd运行目录,我这里是C:\Users\Administrator,找到.ssh目录,进入目录,复制id_rsa.pub的内容。

第二步:登录github,点击右上角头像->点击Settings->点击SSH and GPG keys->点击 New SSH key,任意输入一个名称,粘贴第一步复制的id_rsa.pub内容并保存。

打赏

『微信打赏』

Tag标签git 

我是有底线的