hexo 部署 Host key verification failed. - Gitee

前言

  Hexo 是一种快速、简洁且高效的纯静态博客框架。配置简单,可以很快上手,也可以自定义博客的主题。之所以喜欢它就是因为它可以用Markdown语法来写博客。

  废话不多说,今天在使用hexo d 部署命令时,报错 Host key verification failed

配置

远程部署的配置信息:

deploy:
  type: git
  repo: 
    gitee: git@gitee.com:xxxx/xxxxx.git
  branch: master

具体错误信息

Host key verification failed.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
FATAL Something wrong. Maybe you can find the solution here: http://hexo.io/docs/troubleshooting.html
Error: Host key verification failed.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

    at ChildProcess.<anonymous> (E:\hexo_gitee\blog\node_modules\hexo-util\lib\spawn.js:37:17)
    at ChildProcess.emit (events.js:198:13)
    at ChildProcess.cp.emit (E:\hexo_gitee\blog\node_modules\cross-spawn\lib\enoent.js:40:29)
    at maybeClose (internal/child_process.js:982:16)
    at Socket.stream.socket.on (internal/child_process.js:389:11)
    at Socket.emit (events.js:198:13)
    at Pipe._handle.close (net.js:606:12)

从上面的错误信息可以看出来是 ssh 主机密钥的配置问题ssh-keygen -t rsa -f ~/.ssh/随便名字_id_rsa -C "yourmail@xxx.com"

解决方案

方案一

将远程仓库地址 ssh 更换成 https

repo: 
    gitee: https://gitee.com/xxxxx/xxxxx.git
方案二

执行:
ssh-keygen -t rsa -C "yourmail@163.com" 敲四下,使用默认的名称 rsa_id
或者
ssh-keygen -t rsa -f C:/Users/asus/.ssh/随便名字_id_rsa -C "yourmail@xxx.com" 敲三下,使用自定义名称。

将生成好的 .pub 文件内容添加到码云的个人设 =》SSH公钥

参考

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容