How to double open a blog?
The answer is to deploy a VPS with GitHub...
Well, I admit that I used a clickbait title. The main purpose is to record how I successfully deployed my Hexo blog and then how to deploy it on GitHub.
Create a remote repository#
Create a repository on GitHub with the name "username.github.io". This repository can automatically generate a blog at "username.github.io" after automated deployment. By using GitHub's powerful CDN outside of mainland China (mainland China is like an isolated island on the Internet), our blog will have faster access speed. Note that at the beginning, I chose not to initialize the repository, which can avoid some inexplicable pitfalls!
Modify site configuration#
In the root directory of the site, find the keyword "deploy" in _config.yml
and modify the entire section to:
deploy:
type: git
repo: The complete path of the repository on GitHub including .git
branch: master
The link of the repo must be ssh instead of https!!!
Configure git#
Generate SSH key
git config --global user.name "Your GitHub username"
git config --global user.email "Your GitHub registered email"
Generate SSH key file:
ssh-keygen -t rsa -C "Your GitHub registered email"
Then just press Enter three times, no need to set a password by default.
Then find the id_rsa.pub
key in the generated .ssh
folder and copy all its contents.
Open the GitHub_Settings_keys page and create a new SSH Key.
The Title
can be any title, then paste the contents of id_rsa.pub
that was just copied, and finally click Add SSH key
.
Great success!
The above content is from GitHub+Hexo Building Personal Website Detailed Tutorial
Push the blog to GitHub
Okay, we can use the following command to push the blog to GitHub and achieve a certain level of neveroffline™!
Celebrate~~