10

I installed Octopress in GitHub Pages.

And I clone the repository.

$ git clone [email protected]: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?

1
  • 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”). Jul 12, 2013 at 9:19

2 Answers 2

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

2
  • 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! Sep 27, 2013 at 23:53
  • 1
    I wasted almost 2 hrs on this but your comment saved many hours. Thanks a lot :)
    – Ashit Vora
    Jan 29, 2014 at 5: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.

1
  • 2
    Perfect - worked for me. Although I did run into merge conflicts with each file, but took the head for each file. Feb 21, 2014 at 4:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.