First, demand:
You need to manage and update Hexo under Windows and Macs, or to redeploy the environment.
second, the idea
Create a branch where a branch is used to hold the original file of the Hexo generated site, and another branch to hold the generated static Web page.
third, build the process
1, on GitHub to create a warehouse, Ljaer.github.io; 2. Create the Ljaer.github.io locally; 3. Perform the NPM install Hexo, Hexo init, NPM install and NPM install Hexo-deployer-git next time in the local Ljaer.github.io folder;
4. Under the local Ljaer.github.io folder
Create a file. Gitignore
This file is not a suffix, open after writing to the following two folders
/.deploy_git
/node_modules
Deploy_git is Hexo D rendering and uploaded to GitHub, each time Hexo D will be covered;
/node_modules is the plugin generated by NPM install, no need to upload, and can not upload.
Note:
Many of the tutorials at the beginning of the backup did not describe the. gitignore file, after the recovery, after the Hexo D always error, sent in the mailbox of the wrong content
GitHub sent the contents of the mailbox, said: There is no initialization of the module, here refers to. deploy_git This module
#Git initialization
Git init
#Used to store the source
git checkout-b hexo
#git file to add
Git Add.
#git commit
git commit-m "init"
#Add remote warehouse
git remote add Origin git@github.com:ljaer/ljaer.github.io.git
# Push to Hexo branch
git push Origin Hexo
5, modify the _CONFIG.YML in the Deploy parameter, the branch should be master; 6. Execute git add in sequence, git commit-m "...", Git push origin Hexo submit website related files; 7. Execute Hexo g-d build website and deploy to GitHub
In this way, the Git@github.com:ljaer/ljaer.github.io.git repository on GitHub has two branches, a Hexo branch is used to store the site's original files, and a master branch is used to store the generated static Web pages. Iv. Recovery
After reinstalling your computer, or if you want to modify your blog on another computer, you can use the following steps: 1. Install Hexo First
$ NPM install-g hexo-cli 2, existing on GitHub git clone down
git clone Git@github.com:ljaer/ljaer.github.io 3, project folder under NPM
CD Project name/CD project name/NPM install–no-bin-links
$ NPM Install Hexo-deployer-git 4, reconfigure GitHub and coding public key five, update
After every writing,
Execute Hexo D First, push the content you want to post to GitHub, and then back up the reference link .
Hexo Backup and restore: http://jizailog.com/2016/06/13/hexo-backup/