0%

更新hexo+github上传方法

更新hexo+github上传方法

cd D:\BaiduSyncdisk\ZM\blog

npm install hexo-abbrlink –save

ssh-keygen -t rsa -C “zhangcb21@lzu.edu.cn

用txt打开pub,加入到settings中的ssh

ssh -T git@github.com

1
2
3
4
5
6
7
8
$ ssh -T git@github.com
The authenticity of host 'github.com (20.205.243.166)' can't be established.
ED25519 key fingerprint is SHA256:+DiY3wvvV6TuJJhbpZisF/zLDA0zPMSvHdkr4UvCOqU.
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? ED25519
Please type 'yes', 'no' or the fingerprint: yes
Warning: Permanently added 'github.com' (ED25519) to the list of known hosts.
Hi cz6900! You've successfully authenticated, but GitHub does not provide shell access.

hexo init

hexo s

1
http://localhost:4000/

config.yml中修改

deploy:
type: git
repository: 你的github地址
branch: main

1
npm install hexo-deployer-git --save
1
hexo g
1
hexo d

可能出现的错误

1
2
3
4
5
6
7
8
9
FATAL {
err: Error: Spawn failed
at ChildProcess.<anonymous> (C:\Users\myosotis\Desktop\Hexo_blog\node_modules\hexo-util\lib\spawn.js:51:21)
at ChildProcess.emit (events.js:315:20)
at ChildProcess.cp.emit (C:\Users\myosotis\Desktop\Hexo_blog\node_modules\cross-spawn\lib\enoent.js:34:29)
at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12) {
code: 128
}
} Something's wrong. Maybe you can find the solution here: %s https://hexo.io/docs/troubleshooting.html

方法一

1
2
3
4
5
6
7
8
9
10
##进入站点根目录

##删除git提交内容文件夹,
rm -rf .deploy_git/

##执行
git config --global core.autocrlf false

##最后
hexo clean && hexo g && hexo d

还需要手动删除这个文件夹 deploy_git/

方法二

修改 _config.yml 文件,将配置地址http方式切换成ssh方式

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
##进入站点根目录

##删除git提交内容文件夹
vim _config.yml

##修改
deploy:

type: git

repository: https://github.com/Uninfo/blog.github.io.git
-> git@github.com:Uninfo/blog.github.io.git

branch: master

##最后
hexo clean && hexo g && hexo d

方法三

强制上传,不建议

1
2
3
4
5
6
7
##进入站点根目录

##进入depoly文件夹
cd .deploy_git/

##强制推送
git push -f

第一步先根据提示在node_modules中删除对应模块
第二步 安装下列模块
npm install –save hexo-pdf
npm install –save hexo-generator-topindex
npm i object-assign
npm install –save hexo-deployer-git

谢谢你们对我的支持!

欢迎关注我的其它发布渠道