报错[email protected]: Permission denied (publickey). fatal: Could not read from remote repository

报错如下:
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.

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

[email protected]:权限被拒绝(公钥)。
无法从远程存储库中读取。
请确保您有正确的访问权限,存储库存在与否。

解决办法两个

第一个
看本地的.git/config设置的仓库url地址和gitee或github使用的链接地址是否一致如下图,如use https,则url需要用https的仓库地址
shift+右键运行powershell窗口,运行cat .git/config

[core]
        repositoryformatversion = 0
        filemode = false
        bare = false
        logallrefupdates = true
        symlinks = false
        ignorecase = true
[remote "origin"]
        url = [email protected]:furfur-jiang/vue_shop.git
        fetch = +refs/heads/*:refs/remotes/origin/*

url = [email protected]:furfur-jiang/vue_shop.git 观察url是否和github或者gitee使用的链接地址是否一致
报错git@gitee.com: Permission denied (publickey). fatal: Could not read from remote repository_第1张图片
如果一致,那就只能寻求第二个解决办法

解决二:重置ssh公钥
先将原本在C:\Users\xxx/.ssh/id_rsa 内的备份一下,然后清空文件,
再添加公钥,gitee和github都有说明文件,例如 gitee的添加公钥说明

问题解决!

你可能感兴趣的:(Git)