搭建Hexo博客(二)-连接github

  没有github账号先需要创建账号,地址:https://github.com/join?source=header

有账号的看下面:

1、创建repo

创建一个repo,名称为yourname.github.io, 其中yourname是你的github名称,按照这个规则创建才有用,如下:


 

2、设置githubpage

  接下来点击 Settings 进入该仓库的设置页面,找到Github Pages这一项,选择以Master分支作为 source,然后保存;接下来这个仓库就会被部署到 https://{username}.github.io/{仓库名}

  如果你希望直接通过 https://{username}.github.io/ 来访问你的博客,可以将仓库名改为 {username}.github.io;这样就不需要在url后边添加上仓库名来访问了。所以第一步中建议把博客的仓库名称命名为{username}.github.io

 

3、配置Hexo_config.yml

deploy:

type: git

repo:https://github.com/birdben/birdben.github.io.git

branch:master

 

# 要提交到Github上需要安装hexo-deployer-git插件

$ npm install hexo-deployer-git --save

 

后面写文章操作:

hexo n “文章标题”

source/_posts会创建文章标题.md

编辑文章

hexo g 生成文章

hexo s 启动本地服务查看

hexo d 部署到git

 

访问https://{username}.github.io/ 查看文章。

 

 

猜你喜欢

转载自www.cnblogs.com/yangtze-yufei/p/9126211.html