1.安装hugo(windows 请查看官网介绍 https://gohugo.io/getting-started/installing/)

$ brew install hugo
$ hugo version

2.创建hugo 项目

$ hugo new site myblog

3.添加主题

这里我使用m10c,可以自己选择其他

$ cd myblog
$ git init
$ git clone https://github.com/vaga/hugo-theme-m10c.git themes/m10c

4.添加内容(content目录下执行)

$ hugo new post/hugo创建个人GitHub博客.md

之后编辑编辑:hugo创建个人GitHub博客.md

5.本地运行调试

$ hugo  //编译
$ hugo server -D

本地打开http://localhost:1313/调试

6.Theme的设定

打开config.toml

baseURL = "http://fanweixian.github.io/"   //这baseURL是部署后的访问地址。
languageCode = "en-us"  
title = "My New Hugo Site"  
theme = "m10c"  // 你使用的theme 名称

查看下载主题的地址,还有其他的设置

7.部署到GitHub

1)首先在GitHub上创建一个Repository,命名为:fanweixian.github.io (这要和你的baseURL一致。) 2)在myblog目录下执行以下命令

$ hugo --theme=m10c --buildDrafts --baseUrl="https://fanweixian.github.io/"

注意这条命令3个参数都要有,不然待会提交上GitHub就会出现样式的问题。
–buildDrafts 不加会生成无内容的网站
–baseUrl要和config.toml的地址一致。

顺利的话会创建public文件(里面的内容就是你要上传的静态网站的文件。)

$ cd myblog
$ cd public  //在public目录操作
$ git init
$ git remote add origin https://github.com/fanweixian/fanweixian.github.io.git
$ git remote -v  //查看是否设置好了远程地址
$ git add .   //把当前目录的文件添加到本地仓库
$ git commit -m "first commit"  //添加提交的信息
$ git push -u origin master  //git push 也可以

浏览器里访问:https://fanweixian.github.io/ 就可以访问你的博客了。
想新增文章的话从第四步开始就行了。