0%

基于Github搭建hexo博客

搭建博客需要的工具搭建仓库SSH Keys生成本地博客内容发布博客到互联网文档学习备注:取消代理

搭建博客需要的工具

git下载

https://git-scm.com/

Node.js下载

https://nodejs.org/en/download/

​ 验证安装

git -v

node -v

npm -v

安装Hexo

​ 安装命令npm install hexo -g

​ 验证hexo -v

搭建仓库

image-20220916140857457

image-20220916140849281

SSH Keys

打开Git Bash,

ssh-keygen -t rsa -C "邮箱地址"

打开C:\Users\14527\.ssh该路径下的id_rsa.pub,全选复制其中内容

在此处添加New SSH key,把复制的公钥,原封不动的粘贴进去

image-20220916140039675

验证ssh是否绑定成功:

ssh -T git@github.com

若输出如下,则绑定成功

image-20220916140023361

生成本地博客内容

打开文件夹如blog,打开Git Bash

输入命令

hexo init #初始化

hexo g # 生成

hexo s # 启动服务

发布博客到互联网

打开红框文件

image-20220916141805747

把deploy输入如下

deploy:

type: ‘git’

repository: https://github.com/PinzhuoWu/PinzhuoWu.github.io.git # 网址为第二张图

branch: main

image-20220916141744085

image-20220916141701414

npm install hexo-deployer-git --save

image-20220916141918745

输入hexo g生成

image-20220916142847722

输入hexo d把文档推上去

文档学习

image-20220916142516168

参考如下:https://wushishu.xyz/post/be8880ea.html

备注:取消代理

git config --global --unset http.proxy //不设置代理

image-20220916201948780

image-20220916204936676

image-20220916140857457

添加tag与分类

image-20220916234002139