title | tags | date | |
---|---|---|---|
快速搭建自己的个人博客 |
|
2022-05-13 01:50:48 -0700 |
完全免费
-
通过淘宝账号登陆,
codeup.aliyun.com
, 免费。 -
登陆
github.com
,注册一个账号,免费。我这里账号是slcnx
-
安装windows git, https://gitforwindows.org/ 下载之后,直接安装。
需要先验证git, windows 打开
CMD
, 输入git --version
看到版本号,说明git安装OK -
安装windows node, https://nodejs.org/en/download/ 下载之后,直接安装
需要先验证node, windows 打开
CMD
, 输入node --version
看到版本号,说明node安装OK -
安装vscode, https://code.visualstudio.com/ 下载之后,直接安装
-
安装typora, https://typora.io/releases/all 下载, 直接安装
克隆git, 在CMD执行, 以下目录
git clone --recurse-submodules https://github.com/slcnx/hexo-template.git blog
不成功多执行几次, 当看到100% 就表示成功了
现在进入克隆目录
cd blog
克隆子项目git submodule update --init --recursive
现在安装依赖 npm install
现在在命令行输入 start .
看到以下界面
回到上一级目录,blog
目录, 右键 通过 Code 打开
进入到以下界面
现在安装插件, 并退出vscode程序,之后重新 blog
目录, 右键 通过 Code 打开
现在快捷键 ctrl + shift + ` 运行 npx hexo s
访问本地的4000 http://localhost:4000/
查看自己的账号名 , 我的为 slcnx
新建仓库 slcnx.github.io
格式是用户名.github.io
一定要添加index.html
添加之后,刷新网页,过3分钟的样子,右下角出现 active
访问网页 https://slcnx.github.io 用户名.github.io
现在表示github.com已经正常
现在需要生成一个公钥和密钥ssh-keygen -t rsa -b 4096 -f id_rsa_2048 -P ''
命令一定要对
此处一定要在
Linux
主机上生成。之后下载 id_rsa_2048 id_rsa_2048.pub 到本地 博客blog目录
vscode中查看公钥,复制公钥
看到以下内容表示OK
[email protected]:slcnx/slcnx.github.io.git
有docker的同学可以, 可以运行以下命令验证是否正常。没有docker的同学,就不需要执行以下命令
docker build --build-arg [email protected]:slcnx/slcnx.github.io.git --build-arg EMAIL='[email protected]' --build-arg GUSER='songliangcheng' ./
获取https地址 https://codeup.aliyun.com/5f73e5a3728df4b180fab5ca/myblog-2022-05-13.git
先在blog目录中, 即进入CMD中,在blog目录中
git remote set-url origin https://codeup.aliyun.com/5f73e5a3728df4b180fab5ca/myblog-2022-05-13.git
推送代码, 双击push.sh
代码仓库, 已经有数据了
因为代码中有submodule, 就启用
定义构建镜像
配置构建参考,非常关键, 这里有3个参数
EMAIL 你的QQ邮箱
GUSER 你的用户名,任意
GITHUB 这里一定是你上面github创建的仓库的ssh地址,参考4.4获取githubssh地址。我的为 [email protected]:slcnx/slcnx.github.io.git
不需要发布所以删除kubernetes
保存并运行
运行addarticle.sh
脚本, 写标题 第3个文章
会自动弹出博客编写页面 编写第3个文章
---
title: 第3个文章
tags:
- linux
categories:
- hexo
date: 2022-05-13 10:26:14
---
# 背景
hello
![image-20220513102937310](第3个文章/image-20220513102937310.png)
<!--more-->
运行push.sh脚本