使用hexo进行github博客搭建

发布时间 2023-04-03 20:37:00作者: 九叶草

1、你必须建一个存储库,这个存储库要和你的github名称一致(不然就会404),如下图:

2、如果是window配置,需要安装git和node.js

3、下载hexo

npm config set registry https://registry.npm.taobao.org  #换源,下载hexo快一点
npm install hexo-cli -g  #进行下载

4、在本地进行hexo部署。

hexo init

5、执行 npm install,如果不行,可以执行这句:npm install - save

6、执行这段代码:npm install hexo-deployer-git --save

7、分别输入  git config --global user.name "你的昵称"  和  git config --global user.email "你的邮箱"  并替换为你的昵称(我的就是DreamOneYou)和邮箱

8、获取ssh,可以在Git GUI Here进行查看。然后到你的github设置下,找到ssh key设置。

9、找到你安装博客的文件夹找到_config.yml配置文件并打开(可以用Notepad++也可以用记事本打开)

deploy:
  type: git
  repository: 你复制的ssh
  branch: master

10、之后依次执行进行上传:hexo clean;hexo g;hexo d;如果你想本地看一下效果,可以执行:hexo s