首页 > 解决方案 > 来自 Visual Studio Code 的 Git 推送提供“远程:无匿名写访问”

问题描述

当我遇到此错误时,我正在尝试从存储库中推送代码:

没有匿名写访问权限。

我已经按照Visual Studio Code 的 Git 推送中提到的步骤进行操作:“没有匿名写访问。身份验证失败” ,但我仍然遇到了同样的错误。

我需要对该问题中提到的过程进行一些澄清。

完成后cat ~/.ssh/id_ed25519.pub,我看到了格式中的关键

ssh-ed25519 <key> <email>

我是否需要将整个内容复制到key fieldGitHub 帐户中,例如密钥 + 电子邮件或仅密钥?

在此处输入图像描述

除了澄清之外,还有其他解决方案吗?

我根据收到的答案复制了所有内容。但是随后,我将遥控器从 ahttps更改为ssh链接,然后在推送时出现此错误:

sign_and_send_pubkey: signing failed: agent refused operation
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.

标签: gitgithub

解决方案


  1. 澄清:将整个内容复制到 GitHub 帐户的 key 字段中。

    ssh-ed25519 <key> <email>

  2. 如果按照链接中给出的教程后错误仍然存​​在,则将存储库的远程从更改httpsssh使用

    git remote set-url origin git@github.com:<username>/<reponame>.git
    
  3. 现在如果你遇到错误

       sign_and_send_pubkey: signing failed: agent refused operation
       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.
    

    永远不要忘记在推送代码的地方添加 SSH 密钥:

     ssh-add
    

推荐阅读