hexo换电脑

1. 源代码上云端

将源代码上传到github上

1
$ git remote add origin git@github.com:liuhuiIris/liuhuiIris.github.io.git

如果提示错误 **.git

1
2
3
4
5
6
7
8
9
10
$ git init
```


接下来就是常规的git操作
``` bash
$ git checkout -b hexo
$ git add .
$ git ci -m '随便写点什么'
$ git push <<如果首次创建,根据提示输入命令

2. 在新电脑上配置hexo

将代码clone下来,master上是部署的博客,hexo分支上是我们的源代码,切到源代码分支

1
2
3
4
5
$ 1、git clone git@github.com:liuhuiIris/liuhuiIris.github.io.git
$ git checkout hexo
$ sudo npm install hexo -g
$ npm install hexo --save
$ npm install

3. 继续愉快的写博客吧

1
2
3
4
$ hexo new blockName
$ hexo g
$ hexo s
$ hexo d

4. 不成功?

1、服务提示 no index.html

检查thmes文件是否缺失,重新配置下主题,再次编译

2、 重新部署hexo不需要hexo init

如果运行了hexo init也没关系,重新配置 _config.yml文件

1
2
3
4
deploy:
type: git
repository: git@github.com:liuhuiIris/liuhuiIris.github.io.git
branch: master