1. 安装nodejs:  sudo apt-get install nodejs-legacy

2.安装nvm :  wget -qO- https://raw.github.com/creationix/nvm/master/install.sh | sh

3.nvm安装完成后,重启终端并执行下列命令即可安装 Node.js:   nvm install 4

4.安装hexo:

npm install hexo-cli -g

npm install hexo -g

5.将github上的仓库clone下来,并初始化文件夹

git clone git@github.com:username/username.github.io.git
cd username.github.io
hexo init [folder]

6.本地测试

$ sudo hexo generate
$ sudo hexo g
$ sudo hexo server

打开链接就能看到本地的网站了

7.部署到github

这里假设你已经创建好了github密钥.

首先配置_config.yml 

deploy:    这个东西类似 git
type: git
repo: <repository url>  你的仓库地址
branch: [branch]      
message: [message]   commit 的内容

安装 deploy  

npm install hexo-deployer-git --save

编译上传

$ sudo hexo generate
$ sudo hexo deploy

上传层成功后,就能访问 username.github.io 了。

相关文章:

  • 2021-08-06
  • 2022-01-28
  • 2021-10-21
  • 2021-08-22
  • 2021-12-19
猜你喜欢
  • 2022-12-23
  • 2021-09-03
  • 2021-08-04
  • 2021-06-26
  • 2022-02-11
  • 2022-02-09
  • 2021-07-27
相关资源
相似解决方案