基于 本地 和github进行托管
线在github创建一个仓库
准备 git 和 node
安装 Hexo 在git bash 中 输入 npm install hexo -cli -g
建立 文件夹
创建 hexo init 仓库名字.github.io
更改主题
cd 仓库名字.github.io
https://hexo.io/themes/ 这个网站找到 自己喜欢的 网页格式
在_config.yml中进行修改
Title 你博客的名字
Author 你的名字
Theme 刚刚安装的主题名字 就是你的第一个
在_config中进行修改
deploy:
type: git
repository: https://github.com/dushaoqin/dushaoqin.github.io.git
branch: master
在source中进行写文章
md格式
npm install hexo-deployer-git --save
安装自动部署工具 执行代码 hexo s
进入 .git文件中 git pull 进行更换主题
清理 hexo clean
返回上一层目录
Hexo g
Hexo d
上传 文章
Hexo g && hexo d
将博客部署到github
配置生成 SSH
ssh-keygen -t rsa -C 邮件地址@youremail.com
Enter passphrase (empty for no passphrase):<输入加密串>
Enter same passphrase again:<再次输入加密串>
更改Github账号SSH信息
找到~/.ssh/id_rsa.pub文件并复制里面的内容
登录Github并添加密钥,将复制的内容添加到SSH Key中
测试SSH是否配置成功
输入ssh -T git@github.com
系统回复以下说明配置成功Hi username! You’ve successfully authenticated, but GitHub does not
provide shell access.
配置github用户信息
git config --global user.name your name
git config --global user.email your_email@youremail.com
部署到Github
安装hexo git插件
cnpm install hexo-deployer-git –save
打开根目录配置文件(~/_config.yml),修改部署配置:
deploy:
type: git
repo:
github: git@github.com:Yaer23/Yaer23.github.io.git,master
最后发布并更新博客
hexo g
hexo d