Hexo部署GitHub Pages

hexo

环境要求

  • node.js > 10.13
  • git
  • Hexo
  • 默认你知道Hexo的使用方法

建立一个仓库(repository)

  • 进入GitHub,右上角点击 New repository
  • 将Repository name设置成 你的用户名.github.io ,注意,用户名必须跟你的如出一辙
  • 复制GitHub链接 git@github.com:Chenilove/Chenilove.github.io.git ,注意这里用HTTPS的话每次提交都要登陆,推荐SSH
  • 在Hexo项目根目录下,编辑_config.yml文件,里面修改node

    # Deployment
    ## Docs: https://hexo.io/docs/one-command-deployment
    deploy:
      - type: git # 提交类型git
        repo: git@github.com:Chenilove/Chenilove.github.io.git # 提交仓库地址
       branch: main # 分支GitHub的默认分支是main Gitee的分支是master 能够填branch让hexo默认提交
       message: message # 提交信息
  • 安装插件
npm install hexo-deployer-git --save

issues

  • 执行hexo d每次都要登陆是怎么回事?

    _config.yml里的repo改为SSH(git@github.com)的连接就好了github

相关文章
相关标签/搜索