Windows中搭建已存在的Octopress環境

當咱們須要在不一樣的電腦上來對同一個Octopress博客進行維護的時候就須要針對已存在的Octopress來設置環境了,html

安裝相應的軟件

  1. Git:http://msysgit.googlecode.com/files/Git-1.8.1.2-preview20130201.exe
  2. Ruby:http://files.rubyforge.vm.bytemark.co.uk/rubyinstaller/rubyinstaller-1.9.3-p429.exe
  3. DevKit:http://cloud.github.com/downloads/oneclick/rubyinstaller/DevKit-tdm-32-4.5.2-20111229-1559-sfx.exe
  4. Python:http://www.python.org/ftp/python/2.7.5/python-2.7.5.msi

關於軟件的安裝在《Windows下搭建Octopress博客》中有詳細的介紹。python

拉Octopress代碼到本地

使用下面命令將已存在的Octopress代碼拉到本地git

git clone -b source git@github.com:oec2003/oec2003.github.com.git
git clone  git@github.com:oec2003/oec2003.github.com.git _deploy

編寫文章

cd Octopress
rake new_post['new post title']
rake generate
rake preview
rake deploy

推送到github

cd Octopress
git add .
git commit -m 'message'
git push origin source

從github上獲取最新

好比在公司發佈了一篇博文,回到家裏想繼續發博文,就須要先將github上的最新代碼拉到本地:github

cd Octopress
cd _deploy
git pull origin master
cd ..
git pull origin source

今天在家裏的另外一臺電腦上進行生成文章時,發現當執行了命令rake generate 後,生成到public目錄中相應的頁面爲空,沒有任何內容,但在命令行中命令仍是正常執行了,沒有出現異常。最後查出緣由是由於Python的安裝目錄沒有添加到環境變量中。因此建議在準備環境時就就將git、ruby、python的安裝目錄都添加到環境變量中。ruby

相關文章
相關標籤/搜索