将hexo部署到github上

首先在自己的github上创建一个自己的仓库hejixing.github.io

仓库的名称需要自己的github名称 +.+github+.+io

然后hexo的配置文件中修改

# Deployment
## Docs: https://hexo.io/docs/one-command-deployment
deploy:
type: 'git'
repository: git@github.com:hejixing/hejixing.github.io.git
branch: master

type 改成 git ,仓库用自己的github上的ssh链接,建议不要用http链接,不然很难发布上去,注意分支要跟你github上的一样

hexo部署到github上 出现

fatal: unable to access 'https://github.com/a956551943/a956551943.github.io/': Encountered end of file
FATAL {
err: Error: Spawn failed
at ChildProcess.<anonymous> (/usr/local/src/hexo/hanyubolg/node_modules/hexo-util/lib/spawn.js:51:21)
at ChildProcess.emit (events.js:376:20)
at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12) {
code: 128
}
} Something's wrong. Maybe you can find the solution here: %s https://hexo.io/docs/troubleshooting.html

有可能是你的git repo配置地址不正确,可以将http方式变更为ssh方式

申请ssh的key

需要先在

git bash 执行命令,生命公钥和私钥:ssh-keygen -t rsa

一直回车,然后到

执行命令完成后,在window本地用户.ssh目录C:\Users\用户名\.ssh下面生成如下名称的公钥和私钥:

打开id_rsa.pub文件,这个是公钥

然后打开获取到里面的key

在自己的github上创建个ssh的名称,然后将公钥复制进去,点击新增就成功可以用ssh了

一篇文章带你使用SSH方式在 GitHub 添加远程仓库-CSDN博客

cd 到blog的根目录下,然后进行命令 
hexo g
hexo deploy

然后就直接发布到自己的github上了

发布成功后

浏览链接

https://hejixing.github.io/