註冊一個Github帳號html
記住Respository name 中的username
.github.io 的username
必定與前面的Owner 一致。git
安裝Gitgithub
安裝Nodejnpm
建立博客
$ hexo init username.github.io瀏覽器
更改配置hexo
主題安裝工具
爲了使博客不太難看,咱們須要安裝一個主題,切換至剛剛生成的Hexo 目錄,安裝主題post
$ cd username.github.io測試
$ git clone https://github.com/iissnan/hexo-theme-next themes/nextcode
基礎配置:打開文件位置username.github.io/_config.yml
修改幾個鍵值對, 注意配置的鍵值之間必定要有空格。更多設置...
title: 沐雪的小小世界 //你博客的名字
author: 沐雪 //你的名字
language: zh-Hans //語言 中文
theme: next //剛剛安裝的主題名稱
deploy:
type: git //使用Git 發佈
repo: https://github.com/username/username.github.io.git
主題配置:
主題配置文件在username.github.io/themes/next/_config.yml
中修改,這裏略過。
寫文章
在username.github.io/source/_posts下建立一個名爲FirstBlog.md的文件,隨便寫點,好比「Hello World」。
測試
$ hexo s
測試服務啓動,在瀏覽器中輸入https://localhost:4000 就能夠訪問了。
安裝hexo-deployer-git自動部署發佈工具
$ npm install hexo-deployer-git --save
發佈
$ hexo clean
$hexo g
$hexo d
其餘的就看官方文檔吧