1 安装hugo 首先在本地安装hugo https://github.com/gohugoio/hugo/releases/ wget https://github.com/gohugoio/hugo/releases/download/v0.45.1/hugo_0.45.1_Linux-64bit.deb sudo dpkg -i hugo_0.45.1_Linux-64bit.deb 新建博客 hugo new site myblog 添加主题 此处主题使用的是hyde https://github.com/spf13/hyde.git cd myblog/themes git clone https://github.com/spf13/hyde.git 也可以选择maupassant主题 本地测试一下 hugo server --theme=hyde --buildDrafts --watch 如果需要其他机器访问,ip替换博客所在的机器的ip hugo server --theme=hyde --buildDrafts --watch --bind {ip} -p {port} -b http://{ip} 2 生成静态网站 hugo --theme=hyde --baseUrl="https://{name}.github.io/" 3 上传到github 在GitHub上创建一个Repository,命名为:{name}.github.io 这里{name}是用户名 在本地设置git git config --global user.email "[email protected]" git config --global user.name "Your Name" clone自己的空项目,{name}填写自己的用户名,把public下的内容提交到github上 git clone https://github.com/{name}/{name}.github.io.git cp -r {博客目录/public/*} {name}.……

阅读全文