0%

关于个人博客的搭建

关于个人博客的搭建

最近换了新电脑,但是博客系统一直是在旧电脑上搭建的,索性写个文档记录一下搭建过程(万一下次又换电脑了呢hhhh…

安装git

  1. 打开git的官网,下载git
  1. 配置本地git

    首先设置姓名和邮箱(和github账号保持一致)

    1
    2
    3
    git config --global user.name "yourname"
    git config --global user.email "youremail@email.com"
    git config --global --list

    配置环境变量:将本地git下的bin目录复制到Path环境变量中,并使其生效。

    然后生成密钥

    1
    2
    cd ~/.ssh
    ssh-keygen -t rsa

    连续回车之后可以在~/.ssh 下面生成id_rsa.pub 文件,在github中添加一个新的ssh密钥。

  2. 测试git

    1
    ssh -T git@github.com

    配置成功会出现如下:

    1
    2
    3
    4
    5
    6
    7
    PS 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

nodejs官网.

安装hexo

1
2
3
npm install
npm install -g hexo-cli
hexo -v

相关命令

1
2
3
4
5
hexo init  初始化博客项目
hexo clean 清理hexo缓存
hexo s 启动本地站点
hexo d 部署到云服务器
hexo g 生成更新之后的项目文件

一般先hexo clean 清理缓存,然后hexo d -g 生成博客文件,并上传到服务器

博客链接:https://joserii.github.io/

您的支持将鼓励我继续创作!