I changed my computer recently. Tonight I have time to move my Hexo. Here I share how to transfer Hexo after changing my computer.

 

We need to know that there is a.gitignore in our Hexo blog file, and this file means that you don’t upload certain files to Github when you sync, so it doesn’t work for us to just pull down files from Github to the new computer.

 

So here is a method I use.

 

1. Back up your files on your old computer

To save trouble, I recommend deleting the node_modules folder and backing up the rest of the files.

2. New computer preparation

2.1 Getting Git ready

Git download: git-scm.com/downloads

 

Open gitbash and set up the user. Note that this is not login, but setting up a user for your computer. When you upload, tell the remote repository who uploaded it.

Git config --global user.email git config --global user.email git config --global user.Copy the code

GitHub tutorial SSH keys configuration

 

Remember to add git to the environment variable, otherwise you will get an error later when using hexo. ‘git’ is not an internal or external command, nor is it a runnable program or batch file.

 

Added: Add environment variables

  • Direct search environment variables open

  • Add environment variables: Double-click path to open the system variable

  • Go to your git installation directory and add the bin address to your path.

 

2.2 Preparing Node.js

Node.js installation and configuration

 

 

Change your NPM to Taobao source, so that under things under the faster.

npm config set registry https://registry.npm.taobao.org/

(if you don’t understand this is why, it is recommended that you recall the NPM more detailed introduction to source management | how to use NPM commonly used instructions download | | taobao source discharge)

2.3 Get Hexo ready

Now that you’ve remembered how NPM works, do you use NPM to install Hexo

Install Install Hexo

npm install hexo-cli -g

 

 

3. Transfer backup files to the new PC

Just copy your file to the new computer.

Then go to the file, open gitbash or CMD, and install the dependencies (that is, install back the node_modules file that you deleted).

npm install

When you’re done, you should already have the node_modules folder in your folder.

 

4. Download hexo’s Git tool

npm install hexo-deployer-git --save

Once you’ve downloaded it, you can use it as normal on your new computer. Try writing a new article

hexo clean

hexo d

Open your blog and your posts will be updated.