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:
- 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
- Run
npm install
to let the Hexo program install various dependencies to the new computer B through thepackage.json
file. Go here do not runhexo init
- In this way, the project warehouse of your local computer B is pieced together.
- Run
hexo g
, render and generate - Run
hexo s
to preview the website - 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 |
|
Here’s my list after installing Node:
1 |
|
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.