参考链接:这可能是迄今为止最全的hexo博客搭建教程

操作步骤

  1. 安装git和nodejs,并在github创建仓库

  2. 以管理员权限打开cmd,并执行npm install -g hexo-cli安装hexo客户端

  3. 在需要创建博客的目录下执行hexo init blog

  4. cd blog并执行npm install

  5. 编辑blog/_config.yml文件:

    1
    2
    3
    4
    deploy:
    type: git
    repository: https://github.com/Vae1997/Vae1997.github.io.git
    branch: master
  6. 执行npm install hexo-deployer-git --save,确保可以找到git命令

  7. 此时执行hexo g -d后即可访问https://vae1997.github.io/

  8. 可执行如下命令避免每次提交时都需要输入用户名和密码

    1
    2
    git config --global user.name "Vae1997"
    git config --global user.email "844821239@qq.com"

踩坑记录

误提交大于100M的文件

🔴执行hexo d后出现:this exceeds GitHub’s file size limit of 100.00 MB

需退回上一次的提交:参考大文件上传致Github报错

  1. cd blog/.deploy_git
  2. git log查看上次提交
  3. 复制第一个commit后的代码,执行git reset xxxxx
  4. 再次查看提交记录,已经回滚到上一次