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

Hexo迁移新电脑后部署失败:SSH权限问题求助

Hexo部署时提示SSH权限拒绝,但SSH验证已成功

我更换了新电脑,需要将Hexo迁移至此,以下是我的操作流程:

  • 克隆了我的GitHub Pages仓库
  • 删除仓库内所有文件,仅保留.git文件夹,然后将旧电脑上的Hexo文件全部复制到该仓库目录
  • 创建名为hexo的新分支,执行命令:
git add --all
git commit -m 'new branch'

按照教程操作完成后,执行命令:

hexo g
hexo d

出现如下错误:

FATAL Something's wrong.
Error: 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.
    at ChildProcess.<anonymous> (E:\MyProject\samohyes.github.io\node_modules\hexo-util\lib\spawn.js:37:17)
    at emitTwo (events.js:126:13)
    at ChildProcess.emit (events.js:214:7)
    at ChildProcess.cp.emit (E:\MyProject\samohyes.github.io\node_modules\cross-spawn\lib\enoent.js:40:29)
    at maybeClose (internal/child_process.js:925:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)

我推测是SSH密钥问题,于是执行:

ssh-keygen.exe

在c:/usr/myname/.ssh/目录下生成公钥和私钥,并将公钥上传至GitHub仓库。之后执行:

ssh -T git@github.com

得到验证成功的提示:

PS E:\MyProject\samohyes.github.io> ssh -T git@github.com
Enter passphrase for key 'C:\Users\Xudon/.ssh/id_rsa':
Hi samohyes/samohyes.github.io! You've successfully authenticated, but GitHub does not provide shell access.

但再次执行hexo d时,仍出现相同的权限拒绝错误。我已修改了_config.yml文件的部署配置:

deploy:
  type: git
  repo: git@github.com:samohyes/samohyes.github.io.git
  branch: hexo

请问有人知道问题原因吗?感谢!

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.28 04:11:59