Blogging with github pages part3


本篇记录在Mac Yosemite 64bits环境下本地预览github -pages,接上篇blogging with github pages part2


确认本机ruby/git环境(Yosemite自带),在iTerm2中敲入:

$ ruby -v

ruby 2.0.0p481 (2014-05-08 revision 45883) [universal.x86_64-darwin14]

$ git --version

git version 1.9.3 (Apple Git-50)

接下来,使用git命令从github将仓库Clone下来:

$ git clone https://github.com/yinwer81/yinwer81.github.com.git

iTerm2中切换到yinwer81.github.com目录,执行以下命令初始化github-pages环境:

$ gem sources -l

# 将原Gem源拿掉
$ gem sources --remove https://rubygems.org/
# 换成taobao的Gem源镜像
$ gem sources -a http://ruby.taobao.org/

# 安装github-pages环境所需gem包
$ sudo gem install github-pages --no-ri --no-rdoc
$ sudo gem update --no-ri --no-rdoc

# 安装rouge,如果使用pygments,就不用安装
$ sudo gem install rouge --no-ri --no-rdoc

按照以上步骤安装github-pages本地预览环境,基本不会有问题,如下所示:

$ jekyll server --watch

Configuration file: /Users/Yinwer/yinwer81.github.com/_config.yml
            Source: /Users/Yinwer/yinwer81.github.com
       Destination: /Users/Yinwer/yinwer81.github.com/_site
      Generating...
                    done.
 Auto-regeneration: enabled for '/Users/Yinwer/yinwer81.github.com'
Configuration file: /Users/Yinwer/yinwer81.github.com/_config.yml
    Server address: http://0.0.0.0:4000/
  Server running... press ctrl-c to stop.

Mac OS X使用~/.netrc记住密码:

vi ~/.netrc
    machine github.com
    login your_account
    password your_password
:wq

以上,您有任何问题或建议,请给我写邮件


Yinwer /
Published under (CC) BY-NC-SA