User login

Git non fast forward failed to push some refs WHAT?

Searched words: 
problems pushing with git what's going wrong with git pushes?

sudo git push
To /srv/git/drupal-6-agaric-core.git
! [rejected] master -> master (non-fast forward)
error: failed to push some refs to '/srv/git/drupal-6-agaric-core.git'

Uh... right.

But do not fear! This error likely just means other changes have been made that you should pull in first.


ben@server:/var/www/drupal-6-agaric-core$ sudo git pull
remote: Counting objects: 11, done.
remote: Compressing objectremote: s: 100% (6/6), done.
remote: Total 8 (delta 4), reused 0 (delta 0)
Unpacking objects: 100% (8/8), done.
From /srv/git/drupal-6-agaric-core
   c3ee356..ec2d26b  master     -> origin/master
Merge made by recursive.
config/agaric.rb |    7 ++-----
1 files changed, 2 insertions(+), 5 deletions(-)
ben@server:/var/www/drupal-6-agaric-core$ sudo git push
Counting objects: 95, done.
Compressing objects: 100% (89/89), done.
Unpacking objects: 100% (90/90), done.
Writing objects: 100% (90/90), 305.25 KiB, done.
Total 90 (delta 12), reused 0 (delta 0)
To /srv/git/drupal-6-agaric-core.git
   ec2d26b..b9a7b1d  master -> master




Thanks for the clarification!

Spot on.


Helpful, thanks

It was not exactly obvious...


And don't forget to diff

If you're not sure what the conflict is between the two branches, git diff saves the day (more so than git status).

Thanks so much! Works

Thanks so much! Works perfectly.


Sudo is the root user, yes? Is it a good idea to have the drupal application owned by root? Not sure if I am correct here.

Yet Another Solution

I ran into this same issue, what I had to do to resolve the issue was a bit more complex. I tried a simple pull but kept getting some issues about unmerged files (could of been my own ignorance). But to resolve the issue I created a developement branch of my current git repo, reverted the master with --hard, pulled the remote to current, merged current with developement then pushed it to the remote. Something along the lines of whats listed below, it seems to be basiclly a "copy, sync, copy". Hope this helps, also note the commands are not exactly what I did just what was done from memory. Be certain you know what you are doing or have a backup with these commands, do them wrong and you could loose commits completely.

local: git branch devel
local: git reset --hard
remote: git reset --hard
local: git pull
local: git merge devel
local: git push
remote: git commit -m

Post new comment

The content of this field is kept private and will not be shown publicly.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • You can use Markdown syntax to format and style the text. Also see Markdown Extra for tables, footnotes, and more.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <blockquote> <small> <h2> <h3> <h4> <h5> <h6> <sub> <sup> <p> <br> <strike> <table> <tr> <td> <thead> <th> <tbody> <tt> <output>
  • Syntax highlight code surrounded by the {syntaxhighlighter SPEC}...{/syntaxhighlighter} tags, where SPEC is a Syntaxhighlighter options string or "class="OPTIONS" title="the title".
  • Lines and paragraphs break automatically.

More information about formatting options

By submitting this form, you accept the Mollom privacy policy.