Blog created

The creation process

1. Install Node.js and configure the Node.js environment. Run CMD to enter Node -v and NPM -v for verification.

C:\User\ Mario >node -v v6.11.4 C:\User\ Mario > NPM -v 5.4.2Copy the code

2. Install Git and configure the Git environment. After the installation is successful, right-click anywhere on the computer and “Git GUI Here” and “Git Bash Here” are displayed.

Github. IO and Initialize this repository with a README. 3.

4. Install hexo (all the above are custom paths), then go to CD in CMD and use “NPM install hexo -g” to install the hexo.

D:\blog>npm install hexo -g
Copy the code

You can use the “hexo -v” command to check if the installation is successful, and a bunch of things that look like version numbers are successful.

D:\blog>hexo -v
Copy the code

5. In the same folder path, use the command “hexo init” in CMD to initialize the folder, which also needs to wait. This phase comes to an end when “Start Blogging with Hexo” appears.

D:\blog>hexo init
Copy the code

6. In the same directory, use NPM Install in CMD to install required components.

D:\blog>npm install
Copy the code

7. After the component is successfully installed, you can now experience Hexo for the first time by typing “Hexo G”. Then type “hexo s” to open the server and visit the url.

D:\blog>hexo g

D:\blog>hexo s
Copy the code

8. I’m almost done. Now I’m ready to associate Hexo with Github page and use Git bash to set Git’s user name and email.

$ git config --global user.name "maliao"

$ git config --global user.email "[email protected]"
Copy the code

9. Select C:\Users\Administrator. SSH, right-click Git Bash Here, type “ssh-keygen -t rsa -c “[email protected]”, and press enter three times to generate the secret key and obtain two files: Id_rsa and id_rsa. Pub. Run the eval “$(ssh-agent-s)” command to add the key to the ssh-agent. Then run the ssh-add ~/. SSH /id_rsa command to add the generated SH key to the ssh-agent

$ sh-keygen -t rsa -C "[email protected]

$ eval "$(ssh-agent -s)"

$ ssh-add ~/.ssh/id_rsa
Copy the code

10. Log in to Github and click Settings in your profile picture to add SSH. Click SSH and GPG keys on the left, then select New SSH key and copy id_rsa.pub onto it. Enter SSH -t [email protected] in Git bash to test whether SSH is successfully added. If “Hi your user name” appears, congratulations, add successfully!

11. Find the _config.yml file in the blog folder and change the repo value.

Deploy: type: git repository: [email protected]: maliao/maliao. Making. IO. Git branch: masterCopy the code

12. When the setup is complete, run hexo new post “blog name” to create a new blog (before publishing the post use NPM install hexo-deployer-git –save to install a necessary extension). After editing the post in editor, run hexo d -g Your first blog post is out.

Some pits in the construction process

1.Node.js automatically configures the environment during installation.

2. Git download from the official website is very slow, you can choose another way.

3 Installing Hexo is slow and will probably stop somewhere, don’t try to disturb him, just wait.

4. When accessing Hexo locally, Ctrl+C is the same as the copy key you normally use, so be careful not to copy the url and Hexo stops.

5. When you are testing the success of adding SSH, she may present you with a confusing option (YES/NO), which is different from the tutorial. In this case, you should definitely select YES.

6. Do not try to change the type of Git to Github when configuring the Deployment of the new version of Git.

7. When deploying the article again, use the “hexo Clean” command first, or you’ll see what Buddha is.