一、申请新的Repository
- 确保仓库名和用户名一致
- 确保已同步ssh
二、配置本地Hexo
- 编辑本地Hexo根目录下的 _comfig.yml文件1234deploy:type: gitrepository: http://github.com/YourName/YourName.github.io.gitbranch: master
注意,type: repository: branch: 前面有两个空格,冒号后面都有一个空格。
三、部署到Github
- 切换到hexo根目录
- 执行命令 12hexo generatehexo deploy
最后提示:INFO Deploy done: git,部署成功,访问https://YourName.github.io/即可。
报错解决
若执行hexo命令报错,一般为SSH未成功设置,重新配置SSH即可。
若提示ERROR Deployer not found: git
则表示未创建hexo-deployer-git
依赖包。执行npm install hexo-deployer-git --save
创建依赖包,重新部署即可。