记hexo迁移到新电脑
2020-06-22 06:00:41 Author: www.safeinfo.me(查看原文) 阅读量:699 收藏

发表于 | 分类于 |

字数统计: 433 | 阅读时长 ≈ 1


拷贝源文件

我比较懒 不搞那些花里胡哨 直接打包博客源文件到新电脑

只需要打包下面这几个文件(我是顺手全打包了)

1
2
3
4
5
6
将下面的文件或文件夹复制到新的博客目录下进行替换
_config.yml
package.json (这个没有用到)
scaffolds/ (这个没有用到)
source/
themes/

环境部署

在新电脑上安装 nodejsGit

安装完了之后 新建一个目录把博客文件解压到文件夹 打开 Git bash

1
2
$ git config --global user.name "username"
$ git config --global user.email "[email protected]"

然后切换到用户主目录

1
$ ssh-keygen -t rsa -C “[email protected]

输入邮件地址一路回车 完成会在 .ssh 目录下生成 SSH 密钥

输入 cat ~/.ssh/id_rsa.pub 查看公钥 复制添加到Coding或者Github

接着切换到博客目录输入 npm install hexo-cli -g 安装hexo

然后直接

一些错误 (坑)

我之前博客是双线部署coding+GitHub 换电脑后只部署到coding 我开始是直接注释

1
2
3
4
5
6
deploy:
type: git
repo:
#Github:https://github.com/funny/funny.github.io.git
Coding:[email protected]:funny/blog/blog.git
branch: master

然后就开始了 hexo d 的时候一直报错

Please make sure you have the correct access rights and the repository exists

在网上找了找都无法解决 后面我改成了

1
2
3
4
5
deploy:
type: git
repo: [email protected]:funny/blog/blog.git
#Github:https://github.com/funny/funny.github.io.git
branch: master

成功解决

报错

The file will have its original line endings in your working directory

解决方法运行下面命令设置一下Git终端禁用自动转换功能就行

1
$ git config --global core.autocrlf  false

我就遇到了这些问题 以后遇到再更新吧

Funny wechat

扫一扫,加入信安圈。


文章来源: https://www.safeinfo.me/2020/06/21/%E8%AE%B0hexo%E8%BF%81%E7%A7%BB%E5%88%B0%E6%96%B0%E7%94%B5%E8%84%91.html
如有侵权请联系:admin#unsafe.sh