目标:使用Hexo生成静态文件,上传GitHub作为博客。
搭建环境
下载安装node.js
下载安装Git,创建GitHub账号,上传SSH-KEY。
具体内容参考此博客。
注意: GitHub新建仓库名:github账号.github.io
博客访问地址: http://github账号.github.io
安装Hexo
$ git config --global core.autocrlf false
$ npm install --unsafe-perm --verbose -g hexo //安装在 \Users\用户名\AppData\Roaming\npm\node_modules目录下
初始化
生成博客文件
$ hexo init MyBlog
$ cd MyBlog
$ hexo generate //生成静态页面
本地启动
执行如下命令,启动本地服务,预览文章。
$ hexo server
在浏览器输入http://localhost:4000就可以看到效果。
网友评论