参考了网上的一些教程,期间也遇到一些问题;但是通过搜索,一般都会找到解决方案。下面简单介绍一下博客的搭建过程。
软件安装与配置
1.下载 Node.js 并安装 点击下载
2.下载 msysgit 即git for windows 并安装 点击下载
3.git安装完成后,打开Git Bash 通过输入如下指令配置身份信息(先注册github账号):
git config --global user.name "yourname"
git config --global user.email "youremail"
4.然后设置ssh,可参考官方教程, 或者另行搜索。
配置安装hexo
1.选定合适的文件夹,点击鼠标右键,选择Git bash,打开git窗口,
2.输入npm install hexo-cli –g
3.然后输入npm install hexo –save
4.输入hexo –v
;查看版本,确定安装成功。
5.初始化hexo:输入hexo init
,然后输入npm install
6.输入hexo g
,再输入hexo s
;然后会提示
INFO Hexo is running at http://0.0.0.0:4000/.Press Ctrl+C to stop.
7.在浏览器中输入http://localhost:4000,就可以访问本地创建的博客
创建github,上传本地博客
1.首先,注册github账号。完成后点击Create a new repository,在Repository name下填写yourname.github.io
2.然后在_config.yml文件中,找到Deployment,然后按照如下修改:
deploy:
type: git
repo: git@github.com:yourname/yourname.github.io.git
branch: master
3.使用git方式进行部署,执行npm install hexo-deployer-git --save
来安装所需的插件,然后输入hexo d
4.随后按照提示,分别输入自己的Github账号用户名和密码,开始上传。
5.最后通过http://yourname.github.io/即可访问刚刚上传的网站。
至此,最基本的博客搭建完毕,后续博客还需要进行进一步的优化。