After changing the computer, how does Hexo sync to the past?

Original link: https://macin.org/2023/05/07/hexosync/

status quo

The computer A I used before and the computer B I use now, all the warehouse files of this blog were stored on computer A, and the warehouse was uploaded to github after filtering through the .gitignore file.

need

  • Multi-computer office, all can achieve blogging anytime, anywhere
  • Save the warehouse source file on the main computer B

operate

Many tutorials on the Internet teach how to create a blog. Most of the ideas are: first install git and hexo framework locally, and then create a folder as a blog warehouse. After local debugging is no problem, upload it to github. After opening the page service, bind Create your own domain name and you’re done.

So when I encounter this situation that needs to be migrated, I still need to find out more by myself. After stepping on some pits, I summed up the idea as follows:

  1. First clone the blog source file on github to the new computer, even if the hexo file is incomplete (because of the filtering of .gitignore file). Command used: git clone [email protected]:xxxx/xxxxxx.git
  2. Run npm install to let the Hexo program install various dependencies to the new computer B through the package.json file. Go here do not run hexo init ?
  3. In this way, the project warehouse of your local computer B is pieced together.
  4. Run hexo g , render and generate
  5. Run hexo s to preview the website
  6. It can be updated normally without any problems. The next operation is the same as on the old computer A.

Precautions

  • You need to configure the git software of the new computer in advance
  • It’s better to get SSH done, and then upload it to the github background. The ssh connection method is much safer and faster

to feel

The framework of Hexo is still a bit inconvenient, because it needs to install the bloated Node , and there are a lot of dependent environments, which is a bit unbearable for patients with obsessive-compulsive disorder.

Here’s my list before installing Node:

 1
2
3
4
5
 brew list
==> Casks
discord motrix obsidiantencent-meetingwechat
google-chromeneteasemusicpicgovisual-studio-code
iina notion telegramwarp

Here’s my list after installing Node:

 1
2
3
4
5
6
7
8
9
 brew list
==> Formulae
brotlica-certificateslibnghttp2node
c-aresicu4c libuv [email protected]

==> Casks
discord motrix obsidiantencent-meetingwechat
google-chromeneteasemusicpicgovisual-studio-code
iina notion telegramwarp

When there are more and more blog articles in the future, the speed problem of Hexo may become more and more prominent.
Therefore, from the comparison of these two points, the Hugo framework may be more attractive.

This article is transferred from: https://macin.org/2023/05/07/hexosync/
This site is only for collection, and the copyright belongs to the original author.