10

I installed Octopress in GitHub Pages.

And I clone the repository.

$ git clone git@github.com:my-name/my-name.github.io.git

$ git checkout source

And

$ rake setup_github_pages

I input my repository name.

And

$ rake gen_deploy

I got error

! [rejected] master -> master (non-fast-forward)

my solution

I resolve this problem, in GitHub delete my-name.github.io.git, and make same name repository and

$ rake gen_deploy

But I don't want to delete repository

What is the best solution?

shingo.nakanishi
  • 2,045
  • 2
  • 21
  • 55
  • There’s no need to repeat “Octopress” in the title – the context of the question is already given by the tags. In addition, Stack Overflow actually auto-adds some tags to the page title. If your title already mentions the tags, they may be displayed weirdly in the Google results (e.g. in this case as “[octopress] rake gen_deploy rejected in Octopress”). – Konrad Rudolph Jul 12 '13 at 09:19

2 Answers2

37

Without deleting the repository

Please keep in mind this is not considered best practice, but it may work for you.

The solution is to force a push on the master branch.

Edit the Rakefile and look for this line:

system "git push origin #{deploy_branch}"

Alter the line by adding a plus (+) before the #{deploy_branch} tag:

system "git push origin +#{deploy_branch}"

Run the command

rake deploy

It should succeed.

Undo the edit you made to the Rakefile!

Idea for this solution came from reading this: https://stackoverflow.com/a/9629458/1369730

Community
  • 1
  • 1
Jesse Fisher
  • 785
  • 5
  • 9
  • 2
    You sir are amazing. I wish I could +1k this. I searched for 2 days on how to resolve this, and nothing else worked but this. Thank you so much! – therealjohn Sep 27 '13 at 23:53
  • 1
    I wasted almost 2 hrs on this but your comment saved many hours. Thanks a lot :) – Ashit Vora Jan 29 '14 at 05:50
21

I have the same problem when hosting my Octopress blog on github pages. I Googled a lot and finally solved this problem.

Just change the directory.

cd octopress/_deploy
git pull origin master
cd ..
rake deploy

Then it's fixed.

jeffbyrnes
  • 2,182
  • 2
  • 22
  • 33