Mac搭建Hexo指南
2015-10-09 15:33
183 查看
Mac搭建Hexo指南
亲身搭建成功,总结的步骤
安装brew包管理器,Mac自带ruby命令ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
安装Nodejs
brew install node
安装hexo
npm config set registry="http://registry.cnpmjs.org" sudo npm install -g hexo
初始化hexo
hexo init <folder> #执行init命令初始化hexo到你指定的目录 例如:hexo init hexo,则会在当前目录下生成hexo目录 以下命令在hexo目录下执行。
安装依赖包
npm install
生成静态网页
hexo generate #自动根据当前目录下文件,生成静态网页 或者hexo g
运行本地服务
hexo server 或者hexo s
此时在浏览器中输入:
localhost:4000,可查看静态的网页
添加博文
hexo new "postName" #新建博文,其中postName是博文题目 例如:hexo n "青云"
刷新上述静态网页,可看到新添加的一篇博文。
PS:博文会自动生成在博客目录下source/_posts/postName.md
部署到github
打开github.com,注册github账户,如名字username,创建仓库仓库username.github.io
配置ssh-key
git config --global user.email "你的邮箱" git config --global user.name "你的用户名" ssh-keygen -t rsa -C "你的邮箱" 回车三次,在~/.ssh/下会生成id_rsa和id_rsa.pub两个文件 复制id_rsa.pub文件内容到github账户下的ssh keys的新建key里面,ADD。
修改hexo目录下_config.yml,在最后添加以下内容
deploy: type: git repository: git@github.com:username/username.github.io.git branch: master
执行
npm install hexo-deployer-git --save
执行
hexo g和
hexo d完成部署
打开浏览器并输入username.github.io来查看你的博客
相关文章推荐
- linux C/C++开发环境搭建指南
- 转Android:简单联网获取网页代码
- 如何为网页添加小宠物挂件:小老鼠、金鱼等
- Device Tree(三):代码分析
- 去掉android应用中的系统标题栏
- iOS 手机通讯录
- Device Tree(三):代码分析
- UVA - 297 Quadtrees
- 操作系统的疑问--------有关磁盘与文件系统及系统启动的疑问????
- xcode7/ios9中 低版本app运行时,屏幕上下出现黑边的问题
- HDU 3608 最长回文
- 深入了解canvas
- nodejs 上传图片(服务端输出全部代码)
- 设双链表表示的线性表L=(a1,a2,a3.....an)将L改造为L=(a1,a3,....an...a4,a2)
- URAL 1136 Parliament
- 一、break和return在多层for循环中的作用
- Device Tree(二):基本概念
- 在myEclipse上,基于jetty的android服务端环境配置
- Error:diff: /../Podfile.lock: No such file or directory
- ASP.NET 4.0尚未在 Web 服务器上注册 解决方法