准备

安装nodejs,npm和git

前期准备安装教程

nodejs和npm: https://www.jianshu.com/p/13f45e24b1de

git: https://blog.csdn.net/eno_yang/article/details/114782695

github+hexo完整搭建教程

搭建参考教程

大佬写的太太太太详细了,不做重复功,一些我在搭建过程中出现的小问题放在后面供大家参考

https://www.cnblogs.com/liulangmao/p/4323064.html

更换主题

  1. 推荐几款简约风的主题:

    Chic Theme

    Volantis

    Butterfly

    Fluid

  2. 也可以参考知乎上的回答找喜欢的主题:

    有哪些好看的 Hexo 主题? - 知乎

  3. 另外一种方法就是,主题的网址往往会有一些优秀示例,可以找到github链接去扒一扒喜欢博客的_config.yml配置,然后调整自己的博客。

颜色选取

RGB颜色值与十六进制颜色码转换工具 (sioe.cn)

编写博客

新建博客

hexo new "文件名"  # 新建文章

推荐用Typora编写markdown文件

参考:Typora搭配Hexo写文章

上传、提交博客

hexo cl #非必须
hexo g & hexo d

注意事项

  1. 在GitHub上创建博客仓库时,如果仓库名.github.io的仓库名不和用户名一样的话,会出现访问https://仓库名.github.io 404的情况,需要用https://username.github.io/仓库名.github.io 才能正常访问。
  2. hexo g 代替 hexo generate
  3. hexo d 代替 hexo deploy
  4. hexo s 代替 hexo server

Tips

hexo相关

  1. 如何避免hexo每次提交都输入密码?

    https://jingyan.baidu.com/article/c275f6ba15097fe33c756779.html

  2. hexo本地测试运行重启后页面空白,提示 : WARN No layout: index.html?

    其实是因为我在themes文件夹下面git的主题包,只需要保证目录为<Blogname/themes/主题名>就可以正常显示了。

    路径
    路径

    如果还有其他问题可以参考:

    Hexo博客开发之——No Layout:index.html

    https://blog.csdn.net/Calvin_zhou/article/details/91908712

github相关

从2021年初开始我就开始有时候会访问不了github,试过了各种方法还是无效,所以在hexo d 时经常会出现连接超时之类的错误,下面的清单列出了出现过的报错和解决方法的博客,供参考。

  1. 解决github 打开、拉取、推送速度慢的问题

    https://blog.csdn.net/natahew/article/details/81387885

  2. OpenSSL SSL_read: Connection was reset, errno 10054

    https://blog.csdn.net/weixin_43945983/article/details/110882074

    git config --global http.sslVerify "false"
  3. fatal: unable to access 'https://github.com/...'

    https://blog.csdn.net/dashi_lu/article/details/89641778

  4. Failed to connect to github.com port 443: Timed out

    https://www.cnblogs.com/code1992/p/11220261.html

    git config --global --unset http.proxy
  5. Failed to connect to 127.0.0.1 port 1080: Connection refused

    https://blog.csdn.net/weixin_41010198/article/details/87929622

  6. 搭建hexo时,git 推送出现 “fatal: The remote end hung up unexpectedly“ 解决方案

    搭建hexo时,git 推送出现 “fatal: The remote end hung up unexpectedly“ 解决方案_踏实写代码,认真搞学术的小研的博客-CSDN博客

    修改_config.yml 将https://github.com/yourname/yourname.github.io.git改成

    git@github.com:yourname/yourname.github.io.git

    如果这时候提交的时候报”the key you are authenticating with has been marked as read only“的错误,把之前的SSH key删掉,重新新建一个勾选"allow write":

    img
    img