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

18,293

Solution 1

As git tells you in the output It seems that there is already a rebase-apply directory, and I wonder if you are in the middle of another rebase. If that is the case, please try git rebase (--continue | --abort | --skip) you are in the middle of a rebase. You first have to abort or continue this rebase by

git rebase --continue or

git rebase --abort

and then pull again with

git pull --rebase origin master

Solution 2

You must grab the latest change from the the remote before you can push yours. This is what you did with the git pull --rebase but it look like it did not work.

Have you verified that the pull was successful?
The you did not had any conflicts?

try this pull without rebase first and see if its working

git pull origin master

Than you can pull again with --rebase

git pull --rebase origin master

Then do a push

git push origin master
Share:
18,293
YaSh Chaudhary
Author by

YaSh Chaudhary

Updated on July 16, 2022

Comments

  • YaSh Chaudhary
    YaSh Chaudhary almost 2 years

    I was updating my project and when tried to upload it to my repository,got the following error:

    Already did

    git pull --rebase origin master

      ! [rejected]        master -> master (non-fast-forward)
    error: failed to push some refs to 'https://*******/production.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.
    

    I need to update my website but not able to do so.

    EDIT 1:

    > git status gives:

    rebase in progress; onto cda02b2 You are currently rebasing branch 'master' on 'cda02b2'. (all conflicts fixed: run "git rebase --continue")

    nothing to commit, working directory clean