Push a new branch
Create a new branch
Create a new branch like hexo
in blog rep
Set the new branch as default branch in settings
Clone rep and modify
Under any local folder, clone the rep
1 | git clone https://github.com/<Your username>/<Your username>.github.io.git |
Under this local rep folder, delete all items exclude .git
folder
Copy all items from the original blog file exclude .deploy_git
folder. Check if there is a file called .gitignore
and its content looks like:1
2
3
4
5
6
7.DS_Store
Thumbs.db
db.json
*.log
node_modules/
public/
.deploy*/
Meanwhile, focus on if there is any .git
folder under your theme folders. Delete them all, or you will not have your themes config on your other devices.
Push to github
1 | git add . |
Push done.
You could check if all items exclude item in .gitignore
exist in your github rep.
Setup on a new device
Setup git
Install git1
sudo apt-get install git
Setup global config1
2git config --global user.name "yourgithubname"
git config --global user.email "yourgithubemail"
Install hexo
Install NodeJS1
sudo apt-get install nodejs
Install npm, maybe already exist after installing nodejs1
sudo apt-get install npm
Install hexo1
sudo npm install hexo-cli -g
Clone rep and deploy
Under any folder, clone the rep1
git clone https://github.com/<Your username>/<Your username>.github.io.git
Under the local rep folder1
2npm install
npm install hexo-deployer-git --save
Generate and deploy1
hexo g -d
Then you could edit and deploy your blog as usual on this new device
Tips
- Commit and push src rep to github after editing
- Pull first on blog existed device before editing