关于个人博客的搭建
最近换了新电脑,但是博客系统一直是在旧电脑上搭建的,索性写个文档记录一下搭建过程(万一下次又换电脑了呢hhhh…
安装git
- 打开git的官网,下载git
配置本地git
首先设置姓名和邮箱(和github账号保持一致)
1
2
3git config --global user.name "yourname"
git config --global user.email "youremail@email.com"
git config --global --list配置环境变量:将本地git下的bin目录复制到Path环境变量中,并使其生效。
然后生成密钥
1
2cd ~/.ssh
ssh-keygen -t rsa连续回车之后可以在
~/.ssh
下面生成id_rsa.pub
文件,在github中添加一个新的ssh密钥。测试git
1
ssh -T git@github.com
配置成功会出现如下:
1
2
3
4
5
6
7PS C:\Users\czyhh> ssh -T git@github.com
The authenticity of host 'github.com (20.205.243.166)' can't be established.
ED25519 key fingerprint is SHA256:+<something>.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'github.com' (ED25519) to the list of known hosts.
Hi Yourname! You've successfully authenticated, but GitHub does not provide shell access.
安装Node.js
安装hexo
1 | npm install |
相关命令
1 | hexo init 初始化博客项目 |
一般先hexo clean
清理缓存,然后hexo d -g
生成博客文件,并上传到服务器