记hexo迁移到新电脑
拷贝源文件
我比较懒 不搞那些花里胡哨 直接打包博客源文件到新电脑
只需要打包下面这几个文件(我是顺手全打包了)
1 | 将下面的文件或文件夹复制到新的博客目录下进行替换 |
环境部署
在新电脑上安装 nodejs
和 Git
安装完了之后 新建一个目录把博客文件解压到文件夹 打开 Git bash
1 | $ git config --global user.name "username" |
然后切换到用户主目录
1 | $ ssh-keygen -t rsa -C “youremail@example.com” |
输入邮件地址一路回车 完成会在 .ssh
目录下生成 SSH 密钥
输入 cat ~/.ssh/id_rsa.pub
查看公钥 复制添加到Coding或者Github
接着切换到博客目录输入 npm install hexo-cli -g
安装hexo
然后直接
1 | $ hexo g |
一些错误 (坑)
我之前博客是双线部署coding+GitHub 换电脑后只部署到coding 我开始是直接注释
1 | deploy: |
然后就开始了 hexo d
的时候一直报错
Please make sure you have the correct access rights and the repository exists
在网上找了找都无法解决 后面我改成了
1 | deploy: |
成功解决
报错
The file will have its original line endings in your working directory
解决方法运行下面命令设置一下Git终端禁用自动转换功能就行
1 | $ git config --global core.autocrlf false |
我就遇到了这些问题 以后遇到再更新吧
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 Caps!
评论