使用Octopress在Github上搭建博客系统
2015-10-17 19:00
495 查看
1、homebrew
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"[/code]
其间会有提示:Press RETURN to continue or any other key to abort
所以按 return 键开始进行下载安装;下载成功的提示如下:==> Installation successful! ==> Next steps Run `brew help` to get started
表示安装成功!2、安装ruby
安装ruby的过程相对容易,输入下列命令:brew install rbenv
有的教程还有更多的命令,实际上现在已经全部安装完成了,我们并不需要再敲入更多的命令了,可以使用如下命令进行一定的检测,如下:ruby -v
我们会在终端看到ruby的版本信息。3、octopress
3.1 克隆项目
执行命令如下:git clone git://github.com/imathis/octopress.git octopress
然后cd octopress
就这样便可以进入octopress目录了!3.2 安装依赖
安装依赖的命令行如下:gem install bundler rbenv rehash # If you use rbenv, rehash to be able to run the bundle command bundle install
安装bundler出错ERROR: Could not find a valid gem 'bundler' (>= 0), here is why: Unable to download data from https://rubygems.org/ - Errno::ETIMEDOUT: Operation timed out - connect(2) (https://rubygems.org/latest_specs.4.8.gz) ERROR: Possible alternatives: bundler
淘宝的镜像地址:点击跳转
使用方式如下:$ gem sources --add https://ruby.taobao.org/ --remove https://rubygems.org/ $ gem sources -l *** CURRENT SOURCES *** https://ruby.taobao.org # 请确保只有 ruby.taobao.org $ gem install rails
如果你使用 Gemfile 和 Bundle (例如:Rails 项目)
你可以用 Bundler 的 Gem 源代码镜像命令。$ bundle config mirror.https://rubygems.org https://ruby.taobao.org[/code]
这样你不用改你的 Gemfile 的 source。
修改 RVM ,改用本站作为下载源, 提高安装速度。如下,是mac上的修改方法:$ sed -i .bak 's!cache.ruby-lang.org/pub/ruby!ruby.taobao.org/mirrors/ruby!' $rvm_path/config/db
如果遇到如下的提示信息:
You don’t have write permissions
添加 sudo 这样的命令3.3 安装Octopress
安装Octopress应该不是什么大问题,如下:git clone git://github.com/imathis/octopress.git octopress cd octopress gem install bundler rbenv rehash bundle install rake install4、部署到Github
预览
部署前可以在本地预览,输入rake preview
之后在浏览器输入http://localhost:4000/来访问新建仓库
利用octopress的一个配置rake任务来自动配置上面创建的仓库:可以让我们方便的部署GitHub page。在终端输入如下命令:
rake setup_github_pages
弹出之后输入git@github.com:your_username/your_username.github.com.git不要用提示的io,我的是git@github.com/sgxiang/sgxiang.github.com.git
输入以下命令部署博客rake generate rake deploy提交文件
博客的source需要单独提交,执行如下命令就可以将source提交到仓库的source分支下:git add . git commit -m 'Initial source commit' git push origin source5、注意
Octopress 其实为你建立了 2 个分支。
- 一个是 master 分支,用于存放生成的最终网页。另一个是 source 分支,用于存放最初的原始 markdown 文件。
- 平时写作和提交都在 source 分支下,当需要发布时,rake deploy 命令会将内容生成到 public 这个目录,然后将这个目录的内容当作 master 分支的内容同步到 github
相关文章推荐
- 查看github pages文档的方式
- 使用BAE的基于Web.py的简单博客程序
- 新注册
- 四大漏洞入侵博客
- 在Ubuntu系统上安装Ghost博客平台的教程
- 两分钟学会如何在github托管代码
- PHP多用户博客系统分析[想做多用户博客的朋友,需要了解]第1/3页
- 基于CakePHP实现的简单博客系统实例
- 基于jsp+servlet实现的简单博客系统实例(附源码)
- csdn 博客的css样式 v3
- 如何使用Gitblog和Markdown建自己的博客
- github配置使用指南
- github版本库使用详细图文教程(命令行及图形界面版)
- Flask入门教程实例:搭建一个静态博客
- python使用心得之获得github代码库列表
- 让写博客成为一种习惯
- C语言实现的轻量级brainfuck语言解释器
- My Machine Learning
- 机器学习---学习首页 3ff0