Hello Gitblog

Welcome to my blog! This is a static blog based on Git, Hexo, Nodejs and me!
Here you may find some articles about programmng langurage, Linux, vim and other stuff.

This is the first article recording how to build this blog.
Email xingsecongcong@yeah.net for more infomation or discussion.


Prepare local environment

NOTE: By default, all commands below are bash code and would be running in shell or other terminal.

1.Install Git

1
$ sudo apt-get install git

2.Install nodejs

1
2
3
4
5
$ git clone git://github.com/joyent/node.git
$ cd node
$ ./configure
$ make
$ sudo make install

3.Setup SSH

1
2
3
$ cd ~/.ssh
$ ssh-keygen -t rsa
$ cat id_rsa.pub

then add id_rsa.pub’s content to Github: Account Settings->SSH Public Keys->Add another key
test ssh by:

1
$ ssh -T git@github.com

if terminal output has info like below, ssh to Git is OK.

1
Hi username! You've successfully authenticated, but GitHub does not provide shell access.

4.Install hexo at gitblog

1
2
3
4
5
$ mkdir gitblog
$ cd gitblog
$ npm install -g hexo
$ hexo init
$ npm install

Write first blog

1.Create first article

1
$ hexo new "My New Post"

More info: Writing

2.Run server

1
$ hexo server

Once the server is running, your website will run at http://localhost:4000 by default, and Hexo will watch file changes and update automatically.
More info: Server

3.Generate static files

1
$ hexo generate

More info: Generating


Deploy to github

First config git and hexo:

1.Setup Git

1
2
$ git config --global user.name "Your Name"
$ git config --global user.email "your-email@xxx.com"

2.Setup hexo

vim ~/gitblog/_config.yml and set deploy info like below:

1
2
3
4
deploy:
type: github
repo: git@github.com:xxxx/xxxx.github.io.git
branch: master

*xxxx/xxxx.github.io.git is a url of repository on Github. Here tells how to create a repository.

3.Deploy to remote sites

1
$ hexo deploy

More info: Deployment