How to Operate Octopress Blog From Multiple Places
Hi all! I have been using octopress blog for a couple of months now. I find it very interesting to work with. But a problem I used to face with Octopress is that I was unable to operate it from multiple machines. The complete setup was on my laptop and if I want to post anything onto the blog from a system in my institute, I can’t. As long as my laptop was serving my purpose I didn’t bother but one day my hard-disk crashed and then I was left with no other option then finding a solution to operate the blog from multiple places.
I had the basic understanding as to what does different folders inside the octopress folder actually mean.
The octopress repository cotains two branches: Source and Master The Source branch contains the files necessary to generate the blog and the actual blog is contained in the Master branch. While configuring the blog initially the source branch is cloned into the folder named octopress and the files of the actual blog are cloned into the sub-folder named _deploy.
All the files and folders are pushed to the Source branch when we run the git push origin source command on terminal except the _deploy folder which contains the files of the actual blog and are pushed to master branch automatically when we run rake deploy command.
So the steps that I followed are as follows:
Step.1
I Cloned the Source branch to a local directory named Octopress:
git clone -b source git@github.com:username/username.github.com.git octopress
Step.2
CD to the octopress directory just created and cloned the master branch into a directory named _deploy:
git clone git@github.com:username/username.github.com.git _deploy
Step.3
Then I installed ruby as follows:
curl -L https://get.rvm.io | bash -s stable --ruby
rvm install 1.9.3
rvm use 1.9.3
rvm rubygems latest
after this I configured everything according to the octopress guidelines:
gem install bundler
bundle install
rake setup_github_pages
This prompted me to enter read/write URL for my blog
Enter the read/write url for your repository
(For example, 'git@github.com:username/username.github.com)
Here I have omitted the step rake install because it installs the default theme to the octopress and there was already a theme installed on my blog. If you want to install the default octopress theme then run the command rake install before running rake setup_github_pages
That’s it. Now I have a complete copy of my octopress blog. Now I can do whatever I like as i used to do before loosing my blog.
If you want to operate your blog from multiple places you just need to setup a copy of your blog locally on all the machines and then before making changes from any machine do the following:
Go to the octopress directory and pull the source branch:
cd /path/to/octopress/directory
git pull origin source
Go to the _deploy directory and pull the master branch:
cd _deploy
git pull origin master
Make changes and push:
git add .
git commit -m "your message"
git push origin source
Deploy:
rake generate
rake deploy
That’s it!