[Hexo][03] - 用git實行雙電腦update blog

簡單記錄小弟係學校lab同屋企兩部電腦點樣同步更新.


例如, 你係學校/公司的A電腦開始起website, 完成咗上兩個tut的步驟, 而家係屋企B電腦想做更新, 第一步係起番相應既develop environment.

inital on the second computer.

On any directory.

1
npm install hexo

Clone your website file.

1
git clone https://github.com/[youraccount/yourrepository]

On your repository directory install the Node.js package manager.

1
npm install

Install the deployer.

1
npm install hexo-deployer-git

confirm your environnment.

1
2
3
hexo g
hexo s
---INFO Hexo is running at http://localhost:4000 . Press Ctrl+C to stop.

edit something and deploy it to github. Remember to generate your SSH key to github account.

1
hexo d

B電腦可以更新個website喇~ 之後記得backup d file番github.

backup to github after edit.

Backup 3 step!

1
2
3
git add .
git commit -m "any remark you want"
git push origin [your branch name]

A, B電腦都有website file同environment. A電腦要更新要點做呢?

Back to the original computer, how to update.

Replace your local document with github backup.

1
2
git fetch origin
git reset --hard origin/[your branch name]

After edit remember to backup your data to github!

Author: williamlun
Link: williamlun.github.io/2019/10/12/Log-hexo-3/
Copyright Notice: All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.