hexo项目的备份和还原方法。
一个特别无奈的问题,我尝试在我写博客的虚拟机里面使用了一个破坏性的命令,dnf autoremove, 就是这个命令导致我的虚拟机彻底坏了。所以我恢复了快照,但是是两个月前的记录了。发现自己的blog无法恢复,找到了这样一个解决方案。
Note: 之前的思路是去hexo的工作目录下面找blog的项目,编译之后推送静态页面到gtihub。现在是直接把工作目录传上去,用的时候下载下来。
在目录下git clone 自己的Blog项目。
···
git clone https://github.com/xxxx/xxxx.github.io.git
···
在lxxxx.github.io目录下放置.gitignore文件,内容如下:
1 | .DS_Store |
cd 到xxxx.liarlee.io目录下,使用命令新建分支:
1 | git checkout -b hexo |
将hexo工作目提交到缓存
1 | git add --all |
提交到github的hexo分支
1 | git commit -m "Some statement..." |
推送到自己博客项目的hexo分支下
1 | git push --set-upstream origin hexo |
结束
只需要在一个新的电脑上git clone branch hexo 即可
git clone -b hexo https://github.com/xxxx/xxxx.github.io.git