Steps:
Install Node.js
Install Git
Choose the right version of operating system.
Verify if it installed successfully.1
2$ node -v
$ git version
If there is no right to install it, add sudo
at the top.
Install Hexo
1 | npm install hexo-cli -g |
First line for Hexo installation, second line for Git page deployer.
Then,type hexo init
command to initialize Hexo.
Execute commands below and then access to localhost:4000 to view the effect.1
2hexo g
hexo s
Deploy on Github Pages
Register Github account.
Build a new repository.
Create a SSH keypair. Type $ cd~/. ssh
, if shows nothing, we need to create a new keypair.
Type1
$ssh-keygen -t rsa -C "type personal email here"
Then, just press ‘enter’ button unless you need a password.
execute clip < ~/.ssh/id_rsa.pub
and paste it into Github account.
Then, add new SSH key.
Verify: $ ssh -T git@guthub.com
if it shows below, you set up well.
Then set a personal info. It doesn’t require same with Github nickname.1
2$git config --global user.name "type your name here"
$git config --global user.eamil "type your email here"
Copy repository SSH to root Hexo ‘_config.yml’ file1
2
3
4deploy:
type: git
repository: 'paste Github repository here'
branch: master
Branch is default as master.
Execute1
hexo g -d
After a while, you can browse the Github Page by typing “https://
Then next level is to change a beautiful theme and add more extension. These will be introduced later.
FAQ:
1.For Github repository, you need to set Github Pages as master branch not just set in Hexo. Click ‘setting’ in the repository, find ‘Github Pages’, Choose ‘master branch’ in ‘Source’.
- If you cannot push file to Github, you should check if the rsa keypair has been copied into Github pages.
Reference:
https://my.oschina.net/ryaneLee/blog/638440
https://xuanwo.org/2014/08/14/hexo-usual-problem/#Deploy%E4%B9%8B%E5%90%8E%EF%BC%8C%E9%A1%B5%E9%9D%A2%E9%95%BF%E6%97%B6%E9%97%B4404