hexo迁移(win2mac)

hexo迁移到mac电脑

使用安装教程为mac安装homebrew:

注意添加brew到系统路径

1
2
3
4
5

(echo; echo 'eval "$(/opt/homebrew/bin/brew shellenv)"') >> /Users/gloria/.zprofile

eval "$(/opt/homebrew/bin/brew shellenv)

安装node.js和git

1
2
3
4
5

brew install node.js

brew install git

安装hexo

1
2
3
4
5
6

npm install -g hexo-cli

#安装 hexo-deployer-git
npm install hexo-deployer-git --save

从git上将过往博客clone到本地

  • 在原来的电脑上创建hexo分支,并将全部文件夹都上传上去

  • 在新电脑上配置git ssh

1
2
#将hexo分支克隆到本地(注意克隆的时候一定要选择ssh而不是https)
git clone -b hexo git@github.com:XUAN-98-L/XUAN-98-L.github.io.git hexo

hexo初始化

1
2
3
4
5
6
7
#需要进入到hexo文件夹内
npm install hexo --save

#修改_config.yml中deploy的部分,将其从https改为ssh
deploy:
type: git
repo: git@github.com:XUAN-98-L/XUAN-98-L.github.io.git

obsidian 和hexo连用

https://itreefly.com/posts/e5113722.html

obsidian将“文件与链接”中“使用wiki链接“关闭

使用obsidian打开_posts作为仓库,并安装Custom Attachment Location插件
设置Location for new attachment为:
./${filename}
并将rename attachment files打开

将修改后的文件推送到git

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#如果git有不同账号,可生成新的ssh key(用不同文件名保存),此步骤只需要做一次
ssh-keygen -t ed25519 -C "你的新账号邮箱" -f ~/.ssh/id_ed25519_xuan98l
#加载到agent里
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519_xuan98l
# 可选:把老的也确保已加载
ssh-add ~/.ssh/id_ed25519
#在新 GitHub 账号的 Settings → SSH and GPG keys 里,添加新公钥的内容:
cat ~/.ssh/id_ed25519_xuan98l.pub

git config user.name "XUAN-98-L"
git config user.email "GitHub邮箱"

git add .
git commit -m “提交消息”
git push

hexo迁移(win2mac)
https://xuan-98-l.github.io/2024/05/27/hexo迁移/
Author
Xuan Liu
Posted on
May 27, 2024
Licensed under