highlight: an-old-hope theme: channing-cyan

Tags: [Hexo, Computer, writing, Migration]Copy the code

1. Preparation

Environment Preparation:

  • Git client
  • Node. Js environment
  • Original computer blog important documents
Scaffolds / # draft template file source / # resource file themes/ # theme config file package.json # json config fileCopy the code

2. Install

The new computer (device) creates a blog directory for storing blog files

1. Install Hexo

NPM install hexo-cli -g #Copy the code

⚠️ If the preceding information is displayed, the installation is successful

2. Go to the new computer’s blog directory

Install necessary modules

npm install
Copy the code

3. Install the article deployment to the remote plug-in

npm install hexo-deployer-git --save
Copy the code

Paste the important configuration file of the original computer into the new blog directory of the new computer and replace the original file

3. Preview the local deployment

1, test,

Hexo Server # Start local serviceCopy the code

View the page preview successfully 😀

4. Deploy to the remote repository

Hexo the three musketeers

Hexo generate # Generate static web file Hexo deploy # deploy to remote repositoryCopy the code

4.1. Add SSH Keys to Github

1. Create a local key

Format:

Ssh-keygen -t rsa -c "Github registered mailbox"Copy the code

After the request to confirm the path, and password, all the way to the line

2. Copy the public key to Github

Generally, it is in C:/Users/ user name /.ssh

Open id_rsa.pub with an editor and copy the public key inside

3. Paste the public key

Go to the Github public key setting page

Click New SSH Key to paste the public key in

4. Enter the command

eval "$(ssh-agent -s)"
Agent pid 1309

ssh-add ~/.ssh/id_rsa

ssh -T [email protected]
Copy the code

A successfully… Indicates success

This step is to associate the blog with Github instead of having to enter the Github account and password for each deployment

5. Deploy blogs to Github

hexo deploy
Copy the code

If INFO Deploy Done: git is displayed, the remote device is successfully deployed and the page is displayed

Reference:

  • How to use Hexo to continue blogging on a new COMPUTER >>>
  • When Hexo updates the blog, it shows 404>>>