Building a Repository#
1. Register GitHub#
2. Create a repository for storing blog content#
Registration name:#
username.github.io
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
If you see these outputs, it means it's installed
Generate SSH key#
Command
ssh-keygen -t rsa -C "[email protected]"
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
Add SSH key
Test if SSH is successfully bound:#
ssh -T [email protected]
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#
It's better to agree
Then it will prompt that the server is successfully started, and you can see the blog by accessing the corresponding port
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
There's a network issue and it can't connect well
It's recommended to use a proxy
This is the authentication method I have
GitHub might have updated it again
After agreeing, there should be similar output
At this point, your GitHub repository should have blog content
Then you can access the blog by visiting your GitHub repository name
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.