First, the basic environment

1. Install Node.js and configure the Node.js environment

NodeJs Installation (Windows Version)

Install Git and configure the Git environment

Git installed

Hexo installation

1. Create a folder in the right place and enter it

2. Install Hexo and typenpm install hexo -gAnd check whether the installation is successfulhexo -v

3. Initialize the file and enterhexo init

4, Install required components, enternpm install

5. Generate a static file and enterhexo gorhexo generate

6. Start the local service and enterhexo sorhexo server

If the page cannot be redirected, the port may be occupied. CTRL + C to stop the server and type hexo server -p port number to change the port number, for example hexo server -p 5000

7. If you can see the picture below, you will be successful

Create a GitHub repository

1. Create a project

Note: the project must follow the format: account name.github. IO

2. View the project

GitHub Pages is created successfully. Click https://account name.github. IO/to see your blog

Four, related blog

1. Set Git user name and email

Git config –global user. Name –global user. Name –global user.

2. Create an SSH Key

In the user’s home directory, check whether the. SSH directory exists. If so, check whether the id_rsa and id_rsa.pub files exist in the directory.

SSH to check whether the. SSH folder exists, enter ls to list the contents in the file. The following figure shows that there are

If not, open Git Bash and create an SSH Key:

ssh-keygen -t rsa -C "[email protected]"

You need to change your email address to your own, press Enter, and use the default. Since this Key is not used for military purposes, there is no password required.

Pub and id_rsa.pub are the Key pairs of the SSH Key. Id_rsa is the private Key and cannot be leaked, while id_rsa.pub is the public Key and can be safely shared with anyone.

3. Add an SSH Key

1. Log in to GitHub and open Settings and SSH and GPG Keys (2). Fill in any Title and paste the contents of id_rSA. pub in the Key text box (3). Click “Add Key” and you should see the Key (4) already added. Enter SSH -t [email protected] to test whether SSH is added successfully. If you see your username after Hi, you’ve succeeded

Configure Deployment

In the root folder of your blog, find the _config.yml file

deploy:
  type: git
  repository: [email protected]:Sandop/Sandop.github.io.git
  branch: master

Copy the code

Note: 1. Each colon must be followed by a space; 2. Change the repository username to your own username

5. Install extensions

Before generating and deploying articles, you need to install an extension NPM install hexo-deployer-git –save

6. Build deployment

Enter the commands hexo g and hexo d

7. The deployment is successful

After the deployment is successful, visit http:// username.github. IO. You will see your own blog

Five, set the theme

There are two main configuration files in Hexo, both named _config.yml. One, located at the root of the site, contains the configuration of Hexo itself; The other is in the topic directory, and this configuration is provided by the topic author to configure topic-related options.

For ease of description, the former is referred to as a site profile and the latter as a topic profile in the following notes.

PS: A special note is that there must be a space after the colon, otherwise there may be a problem.

1. Install the NexT theme

In the terminal window, navigate to the Hexo site directory. Use Git checkout code:

git clone https://github.com/iissnan/hexo-theme-next themes/next

2. Enable themes

When the clone/download is complete, open the site configuration file, find the theme field, and change its value to Next.

3, check the effect

It is best to use Hexo Clean to clear the Hexo cache after switching themes but before validation. Then view the effect locally

Hexo s-g generates a static file to start the local service

Sync your blog

After no problems with local browsing, you can sync to the blog and perform hexo D

5. Visit my Hexo + Github blog

Check out my Git blog at sandop.github. IO /