0%

hexo博客备份

备份步骤

  1. 在博客目录下,创建git仓库
    git init
  2. 创建.gitignore文件
    文件内容:
    1
    2
    3
    4
    5
    6
    7
    .DS_Store
    Thumbs.db
    db.json
    *.log
    node_modules/
    public/
    .deploy*/
  3. 将本地与远程仓库关联
    git remote add origin git@github.com:sjtu-xx/sjtu-xx.github.io.git
  4. 设置hexo为默认分支
  5. 本地新建hexo分支
    git checkout -b hexo 创建新分支
  6. 上传至github
    1
    2
    3
    git add .
    git commit -m "blabla"
    git push origin hexo
  7. hexo g -d 发布博客

恢复步骤

  1. git clone https://github.com/sjtu-xx/sjtu-xx.github.io.gito
  2. 在克隆的文件夹下输入npm install hexo-cli,npm install,npm install hexo-deployer-git