GitHub is a project for open source and proprietary software hosting platform, is a distributed version control system, as detailed Baidu Encyclopedia.
Github Pages is a feature on github, you can place the page file to a specified folder, and then give you a unique domain name for show some projects, but now mostly used to develop the production of personal blog sites.
Then step by step in accordance with the steps I used to build personal blog.
ready
Git client installation, operation and related Git, this part of your own Baidu.
nodeJs, mainly as a local server can preview the effect.
Hexo, it is a fast, simple and efficient framework blog. There is also a Jekyll, said the Internet fast Hexo speed, all tried it, feel beautiful and Hexo relatively simple point.
yilia, a template interface only, you can choose like, here is https://github.com/voidking/hexo-theme-yilia.git .
Github configuration
Git client configuration, Github account application, SSH Key Configuration.
Creating a warehouse, named username.github.io (username is your account name)
The establishment of two branch, master for web publishing, in addition to a blog for Hexo page file, manually managing and editing a blog branch, set GitHub Pages for master branch in setting the repo's.
Hexo environment configuration
Installation nodejs
will be created above the repo clone to a local, open Git Bash.
1 |
|
Hexo common commands
Common commands
1 |
hexo new "postName" #新建文章 |
缩写
1 |
hexo n 大专栏 Github+Hexo+yilia快速搭建博客== hexo new |
组合
1 |
hexo s -g #生成并本地预览 |
yilia模板
模板下载,hexo的模板有很多,可以自己选择一款
1 |
#进入themes目录,下载yilia主题 |
配置文件修改, 主题的优化参考 https://www.voidking.com/2015/05/31/deve-hexo-theme-optimize/
1 |
#进入usename.github.io下面的_config.yml修改,主要是下面这一条 |
现在可以在本都预览到yilia样式的博客了。
发布到github
首先是将该项目同步到github的blog分支,普通的git操作。
1 |
git pull origin blog |
然后是将博客生成静态页面deploy到github的master分支。
再次之前,首先配置_config.yml中有关deploy的部分,修改为如下所示。
1 |
Deploy: of the type : git # corresponds warehouse SSH address (can be copied in the corresponding GitHub repository) repo: [email protected]: usename / usename.github.io.git # (branch: User Pages as master, Project Pages for the blog branches) branch: Master |
After configuration, save, and then right-click your project folder open git bash, enter npm install hexo-deployer-git -save install the relevant plug-ins.
Posted HTML code is generated to the master branch with hexo deploy command.
1 |
Generate HEXO |
Daily blog written in the source below _posts folder, written in markdown format, the preview is no problem and then uploaded on the project uploaded to the blog branch, static pages in the master branch.