hexo博客部署在github上,由于更换电脑,需要重新搭建环境

前期准备

  • 下载并安装好Nodejs和git
    Nodejs
    git

  • 设置git全局邮箱和用户名

    1
    2
    git config --global user.name "yourgithubname"
    git config --global user.email "yourgithubemail"
  • 设置ssh key

    1
    ssh-keygen -t rsa -C "youremail"

    生成秘钥后,到显示的相应目录找到公钥,将对应的公钥填到自己的Github中

  • 验证是否成功

    1
    ssh -T git@github.com
  • 安装hexo

    1
    npm install hexo-cli -g

本地项目部署

  • 将项目clone到本地
    在要放的文件夹下
    1
    git clone git@......
  • 装好依赖
    进入clone的文件夹下并安装
    1
    2
    npm isntall
    npm install hexo-deployer-git --save
  • 部署
    1
    2
    3
    hexo cl
    hexo g
    hexo d