重装系统hexo博客重装

标题安装hexo环境

sudo apt-get update
sudo apt-get install nodejs
sudo apt-get install npm

查看nodejs和npm版本号,验证是否安装完成

nodejs -v
npm -v

安装 Hexo

在原hexo博客目录下安装

sudo npm install -g hexo-cli

测试是否安装成功

hexo server

http://localhost:4000下查看服务器是否正常启动

关联github

参考博客
首先生成ssh秘钥

ssh-keygen -t rsa -C "youremail@example.com"

查看所生成的秘钥(其地址在上述创建命令后的有展示)

show '秘钥文件'

复制本地ssh秘钥到github上重新创建一个,然后检验

ssh -T git@github.com

显示下列文字代表关联成功

The authenticity of host 'github.com (207.97.227.239)' can't be established.
RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
Are you sure you want to continue connecting (yes/no)?  # 直接输入yes
Hi cnfeat! You've successfully authenticated, but GitHub does not provide shell access

然后就可以hexo g/hexo d

标题遇到的问题

关联秘钥成功后,hexo d报错:

fatal: LF would be replaced by CRLF in 2020/07/18/AVLTree/index.html
FATAL Something's wrong. Maybe you can find the solution here: https://hexo.io/docs/troubleshooting.html
Error: Spawn failed
    at ChildProcess.<anonymous> (/mnt/d/git/git_tutorial/work/blog/hexo/node_modules/hexo-util/lib/spawn.js:51:21)
    at ChildProcess.emit (events.js:315:20)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)

解决参考博客
运行下列命令后解决

git config --global core.autocrlf false

问题原因:

git在windows下,默认是CRLF作为换行符,git add 提交时,检查文本中有LF 换行符(linux系统里面的),则会告警。所以问题的解决很简单,让git忽略该检查即可

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值