我尝试了 ssh -T git@github.com
并成功通过了身份验证。
这是我尝试推送时遇到的错误。
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.
回答1
从 Visual Studio Code shell 检查您当前的帐户(Linux 上的 id -a
或 Windows 上的 set username
)。
还要检查 HOME(echo $HOME
或 echo %HOME%
),因为 Git /SSH 将在 ~/.ssh
中查找您的 key
确保您推送到您自己的存储库(或您拥有的分支),而不是远程上游原始存储库(您可能不拥有或不是其合作者):git remote -v