124

Updates were rejected because the tip of your current branch is behind hint: its remote counterpart. Integrate the remote changes.

I was trying to push local octopress blog to remote branch. But its saying above error.

another is: Do i have to manage or push the local changes to source or origin branch.?

When i do username.github.io ,i shall see my remote version of the local blog.(i used rake deploy command) But i dont see the updated blog at my username.github.io.I have doubt on branch for origin and source.

alpha9eek
  • 1,439
  • 3
  • 11
  • 10
  • I'm adding this because the question mentions **Octopress**. In my case `rake deploy` was not working because I had modified the Github repository from the website (in my case adding a CNAME file). What fixed the site publication was doing `git pull` **inside the `_deploy/` folder**. After that `rake deploy` was able to publish my changes. – jivimberg May 09 '18 at 15:31

1 Answers1

83

You need to merge the remote branch into your current branch by running git pull.

If your local branch is already up-to-date, you may also need to run git pull --rebase.

A quick google search also turned up this same question asked by another SO user: Cannot push to GitHub - keeps saying need merge. More details there.

Ninjakannon
  • 3,751
  • 7
  • 53
  • 76
Joel Glovier
  • 7,469
  • 9
  • 51
  • 86
  • 1
    The important thing is to ensure you're merging the remote branch into your current branch when you do `git pull`. – Tony Brasunas Apr 14 '15 at 22:05
  • 96
    `git pull` says `Already-up-to-date` but when i do `git push origin my-current-local-branch` it still gives me the same error mentioned on the title of this thread – Awesome_girl Oct 31 '16 at 21:50
  • @Awesome_girl did you fix this? I have the exact same issue, keeps saying my branch is already up-to-date but when I try and git push it says I'm behind – twigg Feb 28 '17 at 10:42
  • 10
    git pull --rebase This goes over the same issue. https://youtu.be/IhkvMPE9Jxs?t=10m36s – Michael James Kali Galarnyk Mar 24 '17 at 03:05
  • 14
    thanks your comment worked for me, But when I run git pull --rebase an error There is no tracking information for the current branch. Please specify which branch you want to merge with. See git-pull(1) for details.... so when i ran git branch --set-upstream-to=origin/master master then git pull --rebase worked perfectlly... stupid read me file caused me all that – Hussein Nasser Jan 12 '18 at 20:30
  • I followed the steps mention by @HusseinNasser as both git pull and git pull --rebase was showing already upto date. And it worked – SUMIT Sep 12 '18 at 07:36
  • I had this exact same problem. I solved it using the SourceTree App and just did a 'push' to the remote server. – lwb Oct 10 '18 at 16:18
  • My issue was I had a branch on the server with the same name as the local branch. I just needed to delete the remote branch and my push worked. – Darth Scitus Sep 11 '19 at 15:42