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

相關文章
相關標籤/搜索