调教Hexo[5]——Hexo网站迁移中一些遗漏的问题

  • 笔记本屏幕坏掉了…正式宣告我本学期开学前后在修南桥芯片上花的将近300几乎打了水漂…
  • 一怒之下搞了个新笔记本,原先的笔记本放在寝室当主机用吧…

于是问题来了,我又双叒叕得迁移一次网站,然后又双叒叕遇到一系列问题. 在此记录,权当之前《迁移》一文的补充.

环境配置与文件同步

感觉不需要多废话…我使用了坚果云来进行同步.

换行符:LF与CRLF之争

将文件迁移好之后,如果贸然 hexo g, d 二连,在部署时会有如下信息:

1
2
warning: LF will be replaced by CRLF in ..... 
The file will have its origional line endings in your working directory.

解决方案

只需要运行如下命令:

1
git config --global core.autocrlf false

再运行 hexo d 即可.

github ssh key的完整配置

首先肯定是要创建 ssh key:

1
$ ssh-keygen -t rsa -C "你的邮箱"

需要输入的地方全都直接回车确认,会在 /.ssh 目录下生成两个文件 id_rsaid_rsa.pub,然后在github上把 id_rsa.pub 添加到ssh key即可.

我做完这些之后就直接开始运行 gd,然而有如下报错:

1
2
Error: ssh: connect to host github.com port 22: Connection timed out
fatal: Could not read from remote repository.

在网上查了一会儿,感觉那些方法看起来都不太适合我的情况. 于是上github的ssh key页面看了一眼,发现github认为我还没有使用过这个key… 此时我想到,这是否是因为我没有验证ssh key… 于是验证了一下:

1
2
3
4
5
$ ssh -T git@github.com

> The authenticity of host 'github.com (192.30.253.112)' can't be established.
RSA key fingerprint is SHA256:xxxxxxxxxxxxxxxxxx.
Are you sure you want to continue connecting (yes/no)?

看到这个信息我有点迷。。。不过还是输了 yes…,随后得到如下提示:

1
2
> Warning: permanently added 'github.com,192.30.253.112' (RSA) to the list of known hosts.
Hi lzcwr! You've successfully authenticated, but Github does not provide shell access.

此时再运行 hexo d 就不再报错了.