hexo上传到github(不用官方方法)

首先,新建完仓库,创建github page(详见第一期

首先cd到网站目录

1
cd 1

然后

1
2
hexo g #生成静态文件
cd public #静态文件目录

然后链接github

1
2
3
4
5
6
git init
git add .
git commit -m "更新"
git branch -M main
git remote add origin git@github.com:luqizhi666/blog.git #自己改对应仓库
git push -u origin main -f #强制

注:第一次需要写好自己用户名密码

随后查看你的仓库若出现内容,恭喜你,成功了!

因为不方便,我写了一个脚本

1.sh

1
2
3
4
5
6
7
cd ~/1
hexo g
cd public
git add .
git commit -m "auto"
git push git@github.com:luqizhi666/luqizhi666.github.io.git -f
git push git@github.com:luqizhi666/luqizhi666.github.io.git -f

运行结果如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
INFO  Validating config
ERROR Plugin load failed: hexo-site
Error: EISDIR: illegal operation on a directory, read
INFO Start processing
INFO Generating urls for last 10 posts
INFO Posts urls generated in submit_urls.txt
https://luqizhi.tk/2023/01/11/hexo%E6%95%99%E7%A8%8B4/
https://luqizhi.tk/2022/12/16/hexo-Linuxdeply%E6%95%99%E7%A8%8B3/
https://luqizhi.tk/2020/12/11/hexo%20%E6%97%A7%E6%89%8B%E6%9C%BA%20linuxdeploy/
https://luqizhi.tk/2022/12/11/%E6%97%A7%E6%89%8B%E6%9C%BAlinuxdeploy%EF%BC%8C2-%E5%AE%89%E8%A3%85%E7%AF%87/
https://luqizhi.tk/2022/12/11/linuxdeploy/
https://luqizhi.tk/2021/11/27/esp8266-1/
https://luqizhi.tk/2021/12/03/esp8266/
https://luqizhi.tk/2021/12/18/esp8266%E7%82%B9%E4%BA%AE0-96%E5%AF%B8oled%E6%98%BE%E7%A4%BA%E5%B1%8F%EF%BC%88tft%EF%BC%89/
https://luqizhi.tk/2021/12/03/esp8266%EF%BC%8C%E6%88%90%E5%8A%9F%E4%BB%A3%E7%A0%81%E9%9B%86/
https://luqizhi.tk/2021/06/30/gmail%E9%82%AE%E7%AE%B1/
INFO
------------------------------------------------
| |
| ________ __ _ __ |
| |_ __ |[ | (_) | ] |
| | |_ \_| | | __ _ __ .--.| | |
| | _| | |[ | | | [ |/ /'`\' | |
| _| |_ | | | \_/ |, | || \__/ | |
| |_____| [___]'.__.'_/[___]'.__.;__] |
| |
| 感谢使用 Fluid 主题 ! |
| 文档: https://hexo.fluid-dev.com/docs/ |
| |
------------------------------------------------

INFO Files loaded in 2.96 s
INFO Generated: submit_urls.txt
INFO Generated: sitemap.txt
INFO Generated: archives/2023/index.html
INFO Generated: archives/2023/01/index.html
INFO Generated: sitemap.xml
INFO Generated: archives/page/2/index.html
INFO Generated: archives/page/3/index.html
INFO Generated: archives/page/4/index.html
INFO Generated: archives/2020/index.html
INFO Generated: archives/2020/12/index.html
INFO Generated: archives/2021/index.html
INFO Generated: archives/2021/page/2/index.html
INFO Generated: archives/2021/page/3/index.html
INFO Generated: archives/2021/06/index.html
INFO Generated: archives/2021/07/index.html
INFO Generated: archives/2021/10/index.html
INFO Generated: archives/2021/12/index.html
INFO Generated: archives/2022/index.html
INFO Generated: archives/2021/05/index.html
INFO Generated: archives/2022/02/index.html
INFO Generated: archives/2022/01/index.html
INFO Generated: tags/hexo/index.html
INFO Generated: tags/linuxdeploy/index.html
INFO Generated: tags/Fluid/index.html
INFO Generated: archives/2021/11/index.html
INFO Generated: archives/2021/08/index.html
INFO Generated: index.html
INFO Generated: page/2/index.html
INFO Generated: page/3/index.html
INFO Generated: page/4/index.html
INFO Generated: 2022/12/16/hexo-Linuxdeply教程3/index.html
INFO Generated: archives/2022/12/index.html
INFO Generated: tags/index.html
INFO Generated: archives/index.html
INFO Generated: 2023/01/11/hexo教程4/index.html
INFO Generated: local-search.xml
INFO 36 files generated in 3.05 s
[master b64a2fd] auto
36 files changed, 1802 insertions(+), 217 deletions(-)
create mode 100644 "2023/01/11/hexo\346\225\231\347\250\2134/index.html"
create mode 100644 archives/2023/01/index.html
create mode 100644 archives/2023/index.html
枚举对象: 139, 完成.
对象计数中: 100% (139/139), 完成.
压缩对象中: 100% (49/49), 完成.
写入对象中: 100% (78/78), 17.38 KiB | 423.00 KiB/s, 完成.
总共 78 (差异 38),复用 0 (差异 0)
remote: Resolving deltas: 100% (38/38), completed with 27 local objects.
To github.com:luqizhi666/luqizhi666.github.io.git
da79d19..b64a2fd master -> master
Everything up-to-date

访问(用户名).github.io

出现!成功!

下期讲sitemap配置!