Skip to content

Instantly share code, notes, and snippets.

@ramnathv
Created October 15, 2012 00:31
Show Gist options
  • Save ramnathv/3890278 to your computer and use it in GitHub Desktop.
Save ramnathv/3890278 to your computer and use it in GitHub Desktop.
Deploy Ruhoh Blog
USER :=
REPO :=
deploy:
cd $(REPO) && \
git init . && \
git add . && \
git commit -m 'update blog'; \
git push git@github.com:$(USER)/$(REPO) master:gh-pages --force && \
rm -rf .git && \
cd ../..

These instructions summarize how to compile and push your ruhoh blog to gh-pages.

  1. Add base_path: REPO in config.yml, where REPO is the name of your project repo
  2. Run ruhoh compile to compile your blog
  3. Switch to your compiled blog: cd compiled
  4. Preview your blog locally: white_castle .
  5. Add your github username and project repo name to the makefile
  6. Run make deploy

The approach taken in the makefile follows the principle that it is not a good idea to put generated files under version control. Here is what the makefile does:

  1. Switch to the repo subfolder in compiled.
  2. Initialize a git repository.
  3. Add all files to the repo
  4. Commit all files with the message "update blog"
  5. Push local master to the gh-pages branch of github, forcefully.
  6. Remove the .git folder.
  7. Switch back to the root folder.

If you use this makefile, your gh-pages branch will always be generated fresh and hence will not store any of the history. The idea is to maintain the blog source under version control since the gh-pages branch can be generated any time.

@plusjade
Copy link

The approach taken in the makefile follows the principle that it is not a good idea to put generated files under version control.

I definitely agree with this philosophy. It seems many people really do want the cleanless (coolness =P) of a username.github.com domain. So I'd have to agree it would be the best idea for ruhoh to officially support a clean way to push to and host on GitHub -- this is definitely a good start to that.

Thanks!

@ramnathv
Copy link
Author

Good to know that you feel the same way. I think octopress follows a similar approach to deploying on github-pages, however using git plumbing commands which I did not understand. I am not sure I really understand the benefits of using git plumbing vs. using these porcelain commands. Any thoughts?

@christophj
Copy link

Hi together,

I'm an absolute beginner at deploying and blogging and github, so sadly, those steps are going too fast for me. So it would be great if you could add some details for me. Basically, I want to run my blog in this repo:

https://github.com/christophj/replicating

So I guess I have to write:

USER := christophj
REPO := replicating

I can compile my ruhoh blog and watch it on localhost:8000, everything works fine. What I don't understand is bullet point 6. How should that work? When I type in that command into the terminal, I get the following error:

make: *** No rule to make target `deploy'. Stop.

I have the following, probably related problem: In your steps, when do I actually need the makefile? Is that needed for the last command? But even when I write "make deploy gistfile1.mak" in the directory the file is, I get the same error.

Sorry, this is probably a very basic question, but I'm quite stuck. The problem is that I haven't used github so far and don't quite get the big picture. Would be great if you could give me some hints.

@christophj
Copy link

OK, short update: I got it running now (see http://christophj.github.com/replicating).

How did I do it? I typed in the commands in the makefile manually, so I guess I just have to find out how to run the makefile.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment