octopress / docs

Source for the octopress.org documentation website
24 stars 30 forks source link

problem with rake deploy #54

Open ravizombie opened 8 years ago

ravizombie commented 8 years ago

I tried to deploy the generated pages and am faced with error

I had tried > rake generate and rake preview ( to check localhost changes) everything seems to be fine.

Steps:

  1. created github pages with the github.io name (https://github.com/ravizombie/ravizombie.github.io.git)
  2. the github repo never creates an empty repo, and instructs one of the 3 ways to have some readme, .gitignore files, or remote repo or the other way
  3. After having a simple readme file created in the repo, I tried following all the steps outlined in http://octopress.org/docs
    The doc is perfect, except for some notes whensomeone is faced with errors like these.

    problem with rake deploy

Ravis-MacBook-Pro:octopress ozeoit$ rake deploy

Deploying branch to Github Pages

Pulling any updates from Github Pages

cd _deploy

warning: no common commits

remote: Counting objects: 3, done.

remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0

Unpacking objects: 100% (3/3), done.

From https://github.com/ravizombie/ravizombie.github.io

There is no tracking information for the current branch.

Please specify which branch you want to merge with.

See git-pull(1) for details

git pull <remote> <branch>

If you wish to set tracking information for this branch you can do so with:

git branch --set-upstream-to=origin/<branch> master

cd -

rm -rf _deploy/assets

rm -rf _deploy/atom.xml

rm -rf _deploy/blog

rm -rf _deploy/favicon.png

rm -rf _deploy/images

rm -rf _deploy/index.html

rm -rf _deploy/javascripts

rm -rf _deploy/robots.txt

rm -rf _deploy/sitemap.xml

rm -rf _deploy/stylesheets

Copying public to _deploy

cp -r public/. _deploy

cd _deploy

Committing: Site updated at 2015-10-02 19:59:00 UTC

[master 7a260d7] Site updated at 2015-10-02 19:59:00 UTC

2 files changed, 2 insertions(+), 2 deletions(-)

Pushing generated _deploy website

To https://github.com/ravizombie/ravizombie.github.io.git

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

error: failed to push some refs to 'https://github.com/ravizombie/ravizombie.github.io.git'

hint: Updates were rejected because the tip of your current branch is behind

hint: its remote counterpart. Integrate the remote changes (e.g.

hint: 'git pull ...') before pushing again.

hint: See the 'Note about fast-forwards' in 'git push --help' for details.

Github Pages deploy complete

cd -

ravizombie commented 8 years ago

somehow, i was able to overcome with manually trying what the >rake deploy would do

Hope this helps others. If it could be documented to specify the branch name or pull, if any content exist in the remote repo and merge it along with a commit(as part of rake job). it would be great.

solution

cd _deploy/ git remote -v

git branch --set-upstream-to=origin/master master Ravis-MacBook-Pro:_deploy ozeoit$ git status On branch master Your branch and 'origin/master' have diverged,

git pull You have not concluded your merge (MERGE_HEAD exists). Please, commit your changes before you can merge.

git commit -m"pulled from remote repo” [master e500f79] pulled from remote repo

git status

On branch master Your branch is ahead of 'origin/master' by 7 commits. (use "git push" to publish your local commits) nothing to commit, working directory clean

git push

warning: push.default is unset; its implicit value has changed in Git 2.0 from 'matching' to 'simple'. To squelch this message and maintain the traditional behavior, use:

git config --global push.default matching

To squelch this message and adopt the new behavior now, use:

git config --global push.default simple

When push.default is set to 'matching', git will push local branches to the remote branches that already exist with the same name.

Since Git 2.0, Git defaults to the more conservative 'simple' behavior, which only pushes the current branch to the corresponding remote branch that 'git pull' uses to update the current branch.

See 'git help config' and search for 'push.default' for further information. (the 'simple' mode was introduced in Git 1.7.11. Use the similar mode 'current' instead of 'simple' if you sometimes use older versions of Git)

Counting objects: 118, done. Delta compression using up to 8 threads. Compressing objects: 100% (103/103), done. Writing objects: 100% (118/118), 187.76 KiB | 0 bytes/s, done. Total 118 (delta 21), reused 0 (delta 0) To https://github.com/ravizombie/ravizombie.github.io.git d4a4376..e500f79 master -> master

allenyllee commented 7 years ago

The root cause of this issue probably was that the local master branch was inconsistent with remote master branch.

Following below instruction to fix this issue.

    cd _deploy              
                                                ## change directory to _deploy

    git checkout master             
                                                ## checkout local master branch

    git branch -m master2   
                                                ## rename local master to master2

    git branch -r           
                                                ## list of remote branch

    git checkout origin/master -b master 
                                                ## create a new local master branch and tracking remote master branch

    git pull                
                                                ## pull the remote master branch, insure that the local master branch has Already up-to-date.

    git branch -d master2   
                                                ## delete local master2 branch if not needed.