Welcome to my blog! This is my first blog, but not my last blog. This blog will revolve around how I created a blog based on hexo and sent it. Also some of my little learning experience.

Git and Node

链接:https://pan.baidu.com/s/1p80wxB4nA45LzgiqbOYZRA?pwd=6666
提取码:6666
This package has two apps Git-2.37.1-64-bit and node-v16.16.0-x64.Just like you mind,next next and next.But you’d better remember where to download it from.

install Hexo

Enter cmd input order

1
npm install -g hexo-cli

图片
Creat a folder on the table,Right-click the folder and select Open it with git bash
图片

So let’s initialize hexo

1
hexo init

Before initialization, you need to make sure that the environment variable is added (the path to the bin directory in your blog file is added to the environment variable)

图片

Enter the code to check whether the startup is successful

1
hexo s

图片

The website can be opened according to the URL

1
localhost:4000

图片

Deploy hexo to GitHub

Create a personal account on github

First, you need to have a github account. After logging in to the account, create a warehouse: the warehouse name is your username.github.io,
Examples are as follows:
Create a repository with the same username as yours, followed by.github.io,
Only in this way, when you want to deploy to GitHub in the future, it will be identified, that is, xxxx.github.io, where xxx is your registered GitHub user name
图片

生产SSH到GitHub上

Open the cmd window and run the following command

1
2
git config -- global user.name"your githib name"
git config --global user.emal"your email"

Enter your GitHub username in yourname and your GitHub email in youremail. That way GitHub knows if you have a corresponding account. The user name is the warehouse name, and the email address is the github registration email address. The following is an example:
图片
Prevent typing errors can be checked

1
2
git config user.name
git config user.email

Then go to your home directory: C:\Users\libinbin, right click to open git bash and type:

1
ssh-keygen -t rsa -C 2412757158@qq.com

Then you sign up for github and hit enter three times
图片

Then you will find an.ssh directory under C:\Users\libinbin, which has a public key and a private key. id_rsa.pub is the public key, we need to open it and copy the contents.

Key acquisition mode
Click on the repository you just created and copy
![图片](/ims/14.png “如图所示”)
Then go to github:click setings
图片
Find that we need a key, we just copied the key in the glue, title whatever
图片
Click Add SSH Key

deploy

In this step, we can associate hexo with GitHub, that is, deploy the hexo-generated articles to GitHub, open the site configuration file _config.yml, flip to the end, and modify it as
YourgithubName is your GitHub account

Modifying a configuration file

图片
revise content:

1
2
3
4
deploy:
type: git
repo: git@github.com:goubin18/goubin18.github.io.git
branch: main

图片

Find your own blog path to open

图片
At this point, you need to install deploy-git, which is the deployment command, so that you can use the command to deploy to GitHub.

1
npm install hexo-deployer-git --save

If a message is display``ed, the node environment configuration is incorrect or the command path is incorrect
图片

Then execute the following commands in sequence

1
2
3
hexo c   #清除缓存文件 db.json 和已生成的静态文件 public
hexo g #生成网站静态文件到默认设置的 public 文件夹(hexo generate 的缩写)
hexo d #自动生成网站静态文件,并部署到设定的仓库(hexo deploy 的缩写)

If the system asks you to reply yes or no, then the installation is correct
Finally, go back to the gitbug repository to see if the file was generated and determine whether it was successful