The cause

   On April 1st, when I was browsing in the app named coolapk,I inadvertently read a trend about free access to Alibaba cloud server for six months. I opened the official activity website about Alibaba cloud and verified it is true. At that time I thought: why not get one ESC Cloud Server to play with? But the day’s quota was gone. The next morning I managed to get my quota and start to learn how to use it to build a blog.
   Through the Internet search, I refer to the technical articles of other netizen, step by step build my blog on the cloud server by Wordpress Platform. On the same time, found a free way , which is that deploy blog on github or coding. Now, I’d like to talk the way about deploying hexo blog on github.

Star buiding

My system environment: Windows 10

1. Install Git node.js .

  To the official website of Git and node.js download theirs installation packages and install them. When you are installing, on the Custom Step remember to choose the option: Add To Path .

2. Create github repository.

  Login your Github Account and create a repository named "your user name" .github.io ,finally your blog address is http://"your user name".github.io .

3. Install hexo

  Open the Git Bash program, implementnpm install -g hexo to install hexo, when finished, create a folder on your computer disk, for example I create a folder named hexo on D Drive, and then in Git Bash implement cd /d/hexo to make position in the D Drive’s hexo folder. Next, implement hexo init and would generate your blog building files in hexo folder.

4. Deploy your SSH Key (So you don’t have to enter password).

 implement:

1
ssh-keygen -t rsa -C "your github account's email address" # will generate Provite Key and Public Key on computer's user directory C:\Users\accountName\.ssh

 Find .ssh\id_rsa.pub and use TXT Editor open id_rsa.pub and copy the contents , open your github’s home page, enter Personal Setting -> SSH and GPG keys -> New SSH key and paste on.
   Test:
 implement

1
2
3
ssh -T git@github.com
Or
ssh -T -P 443 git@github.com

  if retune Are you sure you want to continue connecting (yes/no)? then enter yes and press Enter Key, if prompt Hi XXX! You've successfully authenticated, but GitHub does not provide shell access. means your setup succesful.
 At this point you also need to configure:

1
2
git config --global user.name "xxx"// your github's account name,not the nickname
git config --global user.email "xxx@qq.com"// fill in your github registered email

  then open the _config.yml file in the hexo main directory and modify it:

1
2
3
4
deploy:
type: git
repository: git@github.com:your user name/your user name.github.io.git #fill your github user name
branch: maste

 implement:

1
npm install hexo-deployer-git --save #install deployer command

  then do hexo g to generate website files, implement hexo s then you can through http://localhost:4000/ to preview your blog!
  After your custome setting then implement hexo d will deploy your blog on github.