GIT权限被拒绝(公钥)-Fatal无法从远程存储库中读取



我有ssh -T git@github.com命令返回成功验证
我还有ssh-add -l -E sha256返回输出。

git push -u origin main返回

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

有人能帮我吗?

您正在添加HTTPS URL作为远程URL(https://github.com/saumyaphilip/mgc_web.git)

这意味着您的SSH密钥根本没有被使用。

尝试至少切换到SSH:

cd /path/to/repository
git remote set-url origin git@github.com:saumyaphilip/mgc_web.git
^^^

如前所述,SSH远程用户始终是git

最新更新