You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Windows升级Git至2.38.1后出现Permission denied (publickey)错误求助

Git升级至2.38.1.windows.1后「Permission denied (publickey)」问题解决

问题场景

Git 2.29.2.windows.3版本使用正常,升级到2.38.1.windows.1后执行clone命令时出现错误:

git clone git@e.coding.net:deagrace/test/test1.git
Cloning into 'test1'...
git@e.coding.net: 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-keygen生成的RSA密钥。

解决步骤

  • 检查Git使用的SSH客户端路径
    新版Git默认可能切换为自带的OpenSSH,导致系统SSH密钥未被加载。先查看当前Git使用的SSH命令:
    git config --get core.sshCommand
    如果返回为空或指向Git自带的ssh路径,手动指定系统的OpenSSH路径:
    git config --global core.sshCommand "C:/Windows/System32/OpenSSH/ssh.exe"

  • 确认SSH密钥已被代理加载
    运行ssh-add -l查看已加载的密钥列表,如果看不到你的RSA密钥,执行以下步骤:

    1. 启动SSH代理:eval $(ssh-agent -s)
    2. 添加密钥:ssh-add ~/.ssh/id_rsa
  • 测试SSH连接有效性
    直接用SSH命令测试与Coding平台的连接,排除Git配置问题:
    ssh -T git@e.coding.net
    如果返回成功提示,说明SSH连接正常,再重新执行Git命令即可。

  • 手动配置SSH主机规则
    新建或编辑~/.ssh/config文件,添加针对Coding平台的配置,确保密钥被正确识别:

    Host e.coding.net
      HostName e.coding.net
      User git
      IdentityFile ~/.ssh/id_rsa
    

内容的提问来源于stack exchange,提问作者SnowZ

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.16 01:31:07