banner
xingli

xingli

猫娘爱好者

Hexo Blog Building Tutorial

Building a Repository#

1. Register GitHub#

2. Create a repository for storing blog content#

Registration name:#

username.github.io

001

This is what it looks like after it's created

Generate SSH keys#

1. Create a folder and enter it#

Right-click and open Git Bash

image

If you see these outputs, it means it's installed

Generate SSH key#

Command


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

image-20221117191609590

Follow the steps and enter the corresponding folder

Obtain the public key

Open and copy the contents of the pub file

Add this public key to GitHub#

Open GitHub settings

image-20221117192031372

Add SSH key

Test if SSH is successfully bound:#

image-20221117192820350

If it shows success, it's good

Generate content locally#

Right-click on a folder for writing blogs and open Git Bash

It's better to use an English path

Hexo commands#


hexo init # Initialize

hexo g # Generate

hexo s # Start server

If initialization fails: Use a proxy


$ hexo init

This means it's successfully installed

Enter hexo s#

image-20221117193559304

It's better to agree

image-20221117193620388

Then it will prompt that the server is successfully started, and you can see the blog by accessing the corresponding port

image-20221117193717833

Publish the blog to the internet#

Modify the config.yml file#

Change the content under deploy to the following

Install hexo-deployer-git automatic deployment tool in Git Bash:#


npm install hexo-deployer-git --save

If there's an error, use a proxy

Change the source

This is the Taobao source


npm config set registry http://registry.npm.taobao.org/

npm source


npm config set registry=http://registry.npmjs.org

Generate pages#


hexo g # Generate

hexo d # Upload

image-20221117195709432

There's a network issue and it can't connect well

It's recommended to use a proxy

image-20221117195925220

This is the authentication method I have

GitHub might have updated it again

After agreeing, there should be similar output

image-20221117200104978

image-20221117200111762

At this point, your GitHub repository should have blog content

Then you can access the blog by visiting your GitHub repository name

image-20221117200228120

Add a custom interface

Add a custom domain in the page section of the settings

Ping the repository address to get the returned IP

Add the corresponding A record for the domain to the corresponding IP.

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.