利用Github pages建站-超简单小白专属

Github pages可以使用自己的html,js等资源建站。我们可以使用hexo在本地生产静态网页然后发布到github上。废话少说,按照下列步骤执行

1、注册github账号

并新建一个 用户名+github.io的repository。


 

2、安装nodejs

下载地址

在cmd中执行

node -v

 检测是否安装成功,若提示node命令不存在的时候,请将C:\Program Files\nodejs添加到用户环境变量的PATH中

3、安装hexo

$ npm install hexo -g

$ mkdir wiselyman.local

$ hexo init wiselyman.local

$ npm install 

$ npm install hexo-admin --save #安装hexo管理插件,可编辑发布博客

4、配置_config.yml

配置的详细请参照http://hexo.io/docs/configuration.html

我这里只写出需要和github配合那块的代码

#注意冒号后面有一空格,否则报错
deploy:
  type: github
  repository: https://github.com/wiselyman/wiselyman.github.io.git #此地址如下有截图
  branch: master

 
  

5、启动hexo

hexo server -d

6、访问首页

http://localhost:4000



 

7、发布新的博客

http://localhost:4000/admin  使用的是Markdown编辑,很简单自行学习。



 

8、发布到github

$ hexo clean

$ hexo generate

$ hexo deploy #此句执行完以后会让你输入github的账号和密码,输入完成后将会将你当前的静态页面push到github上

 第一次发布要等很长时间才能看到效果,后面发布就很快了。

9、访问github上你的博客

http:wiselyman.github.io



 

猜你喜欢

转载自wiselyman.iteye.com/blog/2149303