[关闭]
@fiy-fish 2017-10-21T07:28:49.000000Z 字数 1514 阅读 1388

mac 上 HEXO 配置个人博客

未分类



开始正式安装

安装命令:npm install -g hexo-cli --no-optional
进入要安装的目录: cd ~/Document/hexo
安装:hexo init
执行:npm install


后期部署

添加文章: hexo new "博客名"
生成静态页面:hexo generate 或者 hexo g
本地启动: hexo sever 或者 hexo s

这时候会有下面的提示信息

  1. INFO Start processing
  2. INFO Hexo is running at http://localhost:4000/. Press Ctrl+C to stop.

打开网页http://localhost:4000/ 就可以看到效果


上传到 Gitub

部署git插件 npm install hexo-deployer-git --save
我的本地项目名字就起名为 hexo
进入文件夹 hexo 得到下面的文件

  1. _config.yml
  2. db.json
  3. node_modules
  4. package.json
  5. scaffolds
  6. source
  7. themes

打开文件 _config.yml
找到 deploy:部署配置
改成下面的语句

  1. deploy:
  2. type: git
  3. repository: https://github.com/gonghonglou/gonghonglou.github.io.git
  4. branch: master

记得把 repository 改为自己的 github 项目名(我们要和自己上面创建的githug项目关联)。

记得所有冒号后面都一个 空格, 不然会失败

部署命令:hexo deploy 或者 hexo d
这时候 打开网址 http://你的github项目名字.github.io
即可以看到 和之前 http://localhost:4000 一样的页面


编辑 发布文章

创建文章: hexo new "文章名字"

所有文章都会在目录 /hexo/source/_posts 下

发布

  1. hexo generate //生成静态页面
  2. hexo deploy // 部署到 gitHub

安装 theme (主题)

这里以安装 hexo-theme-next 为例
cd 到项目文件夹中
执行 $ git clone https://github.com/iissnan/hexo-theme-next themes/next

hexo_config.ymltheme 名称 由 landscape 改为 next
执行下面的语句

  1. hexo clean //清除缓存文件 (db.json)和已生成的静态文件 (public)
  2. hexo g //生成缓存和静态文件
  3. hexo d //重新部署到服务器

主题修改成功


现在我们整个个人博客配置就结束啦, 但是还有个很严重的问题, 因为博客部署在国外网站上, 访问速度相当慢。

把博客同时部署到 gitHub 和 Coding
https://git.coding.net/FlyBB/Flyfishering.github.io.git

这里部署失败了

成功配置好的博客地址
https://flyfishering.github.io


参考文章:
- Mac上搭建基于GitHub的Hexo博客
- 在Mac下通过HEXO在Github上搭建博客
- Github+Hexo+NexT快速建站教程

----


后续遇到的问题:
- 权限不足
Error: EACCES: permission denied, unlink '/Users/sky-fish/Desktop/skyMy/skyProject/hexo/.deploy_git/archives/index.html'
解决办法:在命令前 加上 sudo


添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注