0%

重装heox的问题

说明

  • 由于某原因,把node和hexo升级后,造成无法发生文章到服务器了,记录解决方法
  • 迁移博客到腾讯云

本地环境

  • 准备空的文件夹,用hexo进行初始化
1
hexo init XXXXX/
  • 安装依赖文件
1
2
3
4
5
6
npm install hexo-helper-live2d --save
npm install hexo-asset-image --save
npm install hexo-tag-cloud --save
npm install hexo-abbrlink --save
npm install hexo-deployer-git --save
npm install hexo-generator-searchdb --save
  • hexo-asset-imagehexo-abbrlink 有冲突,造成图片无法展示,修改asset-imageindex.js中代码
1
2
3
4
# E:\moon-full-blog\node_modules\hexo-asset-image\index.js

//var endPos = link.lastIndexOf('.');
var endPos = link.lastIndexOf('/');
  • 创建本地的id_rsa.pub的密码
1
ssh-keygen -C "2847XXX@qq.com"
  • 服务器上新增文件,把本地id_rsa.pub的密码拷贝进去
1
2
vi ~/.ssh/authorized_keys

  • 修改权限
1
2
3
chmod 755 ~
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
  • 测试本地连接服务器,提示输入密码,注意我的用的root用户名
1
2
3
4
5
ssh -v root@82.XX.xx.xx

debug1: client_input_global_request: rtype hostkeys-00@openssh.com want_reply 0
Last login: Fri Aug 26 17:59:47 2022 from 116.128.233.192
Last login: Fri Aug 26 17:59:47 2022 from 116.128.233.192
  • 然后把本地之前的博客的config.yml,主题文件夹,source 拷贝带最新的博客目录

  • 设置邮箱

1
git config --global user.email '28477XXX4@qq.com'
  • 提交到服务器
1
hexo cl &&  hexo g && hexo d