Hexo+matery博客搭建之Github部署


SSH密钥链接

打开Git Bash,配置邮箱和姓名

git config --global user.name Achhhe
git config --global user.email 2238371421@qq.com

生成密钥,将id_rsa.pub的内容复制粘贴到github账户的SSH Key中

ssh-keygen -t rsa -C "2238371421@qq.com"

测试是否免密链接成功,可以多试几次

ssh -T git@github.com

Github部署

github账户新建一个index.html页面

修改站点配置文件_config.yml

url: https://Achhhe.github.io/

deploy:
  type: git
  # repo: https://github.com/Achhhe/Achhhe.github.io  # 半年多没更新blog,再hexo d需要填username,报错
  repo: git@github.com:Achhhe/Achhhe.github.io.git    # 试一下这个可以
  branch: master #要与index.html相同分支s

安装部署插件

# 1
npm install hexo-deployer-git --save
# 或
# 2 如果网不好可以用cnpm,cnpm安装方式可上网搜索
cnpm install hexo-deployer-git --save

部署至github

hexo clean
hexo g
hexo d

参考

SSH密钥链接


  目录
}