Hello World
Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.
Quick Start
Create a new post
1 | $ hexo new "My New Post" |
More info: Writing
Run server
1 | $ hexo server |
More info: Server
Generate static files
1 | $ hexo generate |
More info: Generating
Deploy to remote sites
1 | $ hexo deploy |
More info: Deployment
博客的搭建与备份
https://www.jianshu.com/p/9b87aae19093
备份博客
由于博客是在本地生成的,如果更换电脑,那我们是不是就不能用这个博客了?方法总比问题多,我们可以利用github
来备份博客的文件和数据。
https://github.com/coneycode/hexo-git-backup
1.安装
1 | npm install hexo-git-backup --save |
2.在博客配置文件 _config.yml 中添加:
1 | backup: |
配置中可以设置提交时的信息(message);
可以指定一起备份的主题(支持多个, 逗号分隔);
repository 也可以指定多个地方进行同步备份;
网上说的比较多的是将备份放到博客项目的一个分支里, 即将上面的 branchName 设置成分支名称, git 路径与博客项目 github用户名.github.io 一致;
3.在命令行中执行
1 | hexo backup |
如果原先是通过手动方式进行的备份, 即没有使用插件, 此时再用插件备份是会出错的. 解决方法是将博客目录下的 .git 目录删除, 再执行 hexo backup 命令;
原文
https://memento.net.cn/post/b96cbb80.html
解决index.lock 的办法
1 | git clean -f .git/index.lock |
常用hexo命令
常见命令
1 | hexo new "postName" |
缩写:
1 | hexo n == hexo new |
组合命令:
1 | hexo s -g #生成并本地预览 |
Hexo版本升级
1 | npm i hexo-cli -g |