电脑换系统了,所以hexo环境又要重新搭建,这次使用的是deepin系统,作为国产linux里数一数二的linux发行版,使用体验还是可以的。
安装需要的软件:
git客户端 :
1 | sudo apt-get install git |
node.js :
1 | sudo apt-get install -y nodejs |
npm :
1 | sudo apt-get install -y npm |
Hexo :
1 | sudo npm install hexo-cli -g |
安装过程中如果遇到警告可以不用管
添加新密钥
查看密钥是否添加
1 | ssh -T git@github.com |
提示Permission denied (publickey).
那就是秘钥有问题!!!
创建密钥
1 | ssh-keygen -t rsa -C "你的邮箱地址" |
接着敲3次回车,完成之后在/home/xxx/.ssh/下面可以看到秘钥
查看密钥
1 | cat /home/xxx/.ssh/id_rsa.pub |
上传密钥
打开:github,登录,点击:头像 -> settings -> SSH and GPG keys
接着将以前的秘钥Delete删除
然后点击上方的New SSH key
Title处随便填写一个名字
Key 处将/home/xxx/.ssh/id_rsa.pub里面的内容复制到里面
接着点击Add SSH key
然后输入:1
2ssh -T git@github.com
Hi smelond! You've successfully authenticated, but GitHub does not provide shell access.
配置用户名和邮箱
1 | git config --global user.name "用户名" |
安装相关模块
1 | npm install |
如果出现警告,不用理会,影响不大。
测试
打开之前的hexo项目,新建一篇文章测试:1
hexo new "test"
接着生成静态文件,开启服务1
2
3hexo clean //清除缓存
hexo g //生成静态文件
hexo s //本地启动服务
其他问题:
如果部署网站到设定的仓库出现:1
2
3
4
5
6
7
8hexo d
INFO Deploying: git
INFO Clearing .deploy_git folder...
INFO Copying files from public folder...
INFO Copying files from extend dirs...
[master 5de89e9] Site updated: 2018-06-21 20:31:16
1 file changed, 1 insertion(+), 1 deletion(-)
Warning: Permanently added the RSA host key for IP address '13.250.177.223' to the list of known hosts.
如果出现这条Warning就将/home/xxx/.ssh/下的id_rsa.pub 和 id_rsa删除
1 | rm -rf /home/xxx/.ssh/id_rsa.pub |
最后重新生成密钥并上传。