0%

Hexo + gitHub 搭建成功

用 hexo+github 写博客,是一直欠下的债。从年初拖到现在9月,才终于完成这个配置。

折腾了一天,终于能 deploy 到 github 并显示出来了。具体搭建过程不再复述。

本次搭建,参考了 超详细Hexo+Github Page搭建技术博客教程,以及 Hexo的帮助文档

其中遇到很多障碍:

  1. Github 原来用的私人邮箱注册,现在不想用该邮箱发布博文,于是重新注册了新邮箱。期间尝试了 github 的选项: keep my email address private。
    结果这个选项对后面的 deploy 造成障碍,于是关闭了该选项。

  2. nodej.js 和 git 是年初安装的,现在想看看 npm 已经安装过哪些东西,于是查阅了 ”如何查看 npm全局安装过的包”,指令如下:
    npm list -g --depth 0

  3. 安装 hexo-deployer-git 时报错: npm install hexo-deployer-git --save

1
2
3
4
5
6
7
npm WARN deprecated swig@1.4.2: This package is no longer maintained
npm WARN saveError ENOENT: no such file or directory, open '/Users/irene.liu/package.json'
npm WARN enoent ENOENT: no such file or directory, open '/Users/irene.liu/package.json'
npm WARN irene.liu No description
npm WARN irene.liu No repository field.
npm WARN irene.liu No README data
npm WARN irene.liu No license field.

原因:必须在hexo初始化的那个目录下执行安装!

  1. hexo g 命令后出错:
    1
    2
    3
    4
    5
    FATAL can not read a block mapping entry; a multiline key may not be an implicit key at line 8, column 12:
    description:
    ^
    YAMLException: can not read a block mapping entry; a multiline key may not be an implicit key at line 8, column 12:
    description:

原因:yml 配置文件中,键值对的冒号后少了空格

  1. hexo g -d 后,网页显示404

原因: github 库中缺少 index .html

解决办法:

  1. _config.yml 中用中文书写 title 和 subtitle ,显示为乱码。

解决办法: _config.yml 使用 utf-8 编码保存即可。

最后还有一些疑惑,比如:
今天花了很大功夫配置SSH key 来访问 github,但后续 hexo g -d 时弹出账号密码框。

-------------本文结束,感谢您的阅读-------------