博客搭建

环境配置

Git下载安装:https://git-scm.com/

NodeJs下载安装:https://nodejs.org/zh-cn/

Hexo下载安装:

  • 打开官网:https://hexo.io/zh-cn/index.html

  • 在本地磁盘中:

    • 创建一个hexo文件夹,进入该文件夹
    • 右键->Git Bash Here->在git中依次执行以下命令
    1
    2
    3
    4
    5
    npm install hexo-cli -g
    hexo init blog
    cd blog
    npm install
    hexo server

搭建教程:超详细!0成本搭建个人网站!!【建议收藏】_哔哩哔哩_bilibili

git

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# 查看git账号的名称和邮箱
git config user.name
git config user.email

# 配置git账号的名称和邮箱
git config --global user.name "账号名称"
git config --global user.email "邮箱"

# 没有ssh密钥:生成ssh密钥
ssh-keygen -t rsa -C "你的Git邮箱"

cat ~/.ssh/id_rsa.pub
ssh -T git@gitee.com

# 将ssh密钥添加到GitHub账号:在C盘/Users/你自己的用户名/.ssh文件夹下,有id_rsa、id_rsa.pub两个文件,使用notepad++等工具打开id_rsa.pub,复制其中的内容,千万不要改变其中的内容
# 在GitHub账号中添加ssh密钥
# 修改_config.yml文件:添加以下代码
deploy:
type: git
repo: git@github.com:0201121474/0201121474.github.io.git # 仓库的ssh的地址
branch: master

修改博客主题

  • 打开Hexo官网:https://hexo.io/zh-cn/index.html
  • 首页底部有主题,点击进入
  • 下载喜欢的主题,得到主题的压缩包,解压到博客所在路径/themes文件夹下
  • 修改博客根路径/_config.yml文件
  • 修改背景图:

部署

1
2
3
4
5
6
7
8
9
10
11
12
13

npm install hexo-deployer-git --save

# 生成网页内容
hexo g

# 本地预览博客
hexo s

# 部署博客
hexo d



博客搭建
http://example.com/2024/07/01/博客搭建/
作者
liubai
发布于
2024年7月1日
许可协议