1. Tools and environment construction
1) Register GitHub and create a new repository
2) Download node.js and Git
Download link:
Verify that the installation was successful:
[Note]: MacOS comes with Git, you can directly enter git --version in the terminal for inspection
3) Create a new blog folder for placing blog-related directory files
4) Initialize Hexo
Hexo is a framework for blogging
Copy the command on the home page, enter the terminal of the blog folder, paste the copied command, press Enter, and wait for the download
Then enter hexo init personal_website in the upper directory of the blog folder to initialize
After completion, multiple files will appear in the folder
At this point, the blog environment is set up, go back to the terminal of the blog folder and enter hexo s or hexo sever, copy the link to the browser and you can see that the blog can run locally
2. Publish blog to GitHub
1) Install the plugin
Enter npm install hexo-deployer-git --save in the blog folder terminal
2) Git association
To associate local Git with GitHub, enter ssh-keygen -t rsa -C "Register GitHub mailbox" in the terminal
Find the id_rsa.pub under the .ssh file on the computer and open it, copy the contents, open the SSH andGPG keys in the settings of GitHub, click add new ssh key to paste it, and click add ssh key
After completion, you can enter ssh -T [email protected] in the terminal , if the words successfully appear, it means that the association is successful
3) Modify the hexo site configuration file
Open _config.yml to configure, find deploy, url, etc., and change it to code similar to the following
4) publish
Terminal input: hexo g to generate a web page
Then enter: hexo d publish to github
Deploy done appears to indicate that the release is successful