【问题标题】:Git push from Visual Studio Code gives "remote: No anonymous write access"来自 Visual Studio Code 的 Git 推送提供“远程:无匿名写访问”
【发布时间】:2021-11-14 13:29:08
【问题描述】:

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

没有匿名写访问权限。

我已按照 Git push from Visual Studio Code: "No anonymous write access. Authentication failed" 中提到的步骤进行操作,但仍然遇到同样的错误。

我需要对该问题中提到的流程进行一些说明。

做了cat ~/.ssh/id_ed25519.pub之后,看到了格式里的key

ssh-ed25519 <key> <email>

我是否需要将整个内容复制到 GitHub 帐户的 key field 中,例如 key+email 或仅 key?

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

我根据收到的答案复制了所有内容。但是,我将遥控器从https 更改为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.

【问题讨论】:

标签: git github


【解决方案1】:
  1. 澄清:将整个内容复制到 GitHub 帐户的 key 字段中。

    ssh-ed25519 &lt;key&gt; &lt;email&gt;

  2. 如果按照the link 中给出的教程后错误仍然存​​在,则将存储库的远程从https 更改为ssh 使用

    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
    

【讨论】:

    【解决方案2】:

    将您的公钥something.pub 中的所有内容原样复制到GitHub SSH 设置页面的key 部分。

    密钥应该是这样的:ssh-rsa &lt;key&gt; &lt;username&gt;@&lt;machine_name&gt;

    【讨论】:

    • 在我的情况下就像ssh-ed25519 &lt;key&gt; &lt;email_registered on github&gt;
    • 不确定 git 是否支持 Edwards 的 ssh 方法。
    • 找到这篇文章reference
    • 所以作为你分享的参考,我已经从这里复制了,但后来我将遥控器从https 更改为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.
    【解决方案3】:

    在将代码推送到远程之前,您可以阅读此处以测试您的 SSH 连接:Test SSH connection on GitHub

    【讨论】:

    • 我很感激!
    猜你喜欢
    • 1970-01-01
    • 2021-12-29
    • 2016-04-15
    • 2016-05-03
    • 2021-05-11
    • 1970-01-01
    • 2016-03-27
    • 2019-01-20
    • 2021-10-12
    相关资源
    最近更新 更多