Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting REJECTED_NONFASTFORWARD in netbeans when trying to push to server

Tags:

git

netbeans

I am a new git user.

I have a repository on bitbucket that I would like to import into a .git folder I have created on my live shared host web server ( where I have git installed ). I can give commands via SSH. I am following the instructions in http://joemaller.com/990/a-web-focused-git-workflow/

I have been able to set up the 2 repos on the server as described in the article. I also have the post update and post commit hooks in place. I am trying to test the system by pushing an update to the server. I am using netbeans 7.3 beta git support. However when give the command:

push ( in netbeans ) to ssh://****.com/home/******/site_hub.git 

The output is:

==[IDE]== Nov 19, 2012 10:28:15 PM Pushing git push ssh://***.com/home/***/site_hub.git +refs/heads/master:refs/heads/master Repository Updates Branch : master Old Id : 0121897bdd7cf3caad9e18717fc27a7a08*** New Id : 837c194c70fb41dc7de3be7841c946ca*** Result : REJECTED_NONFASTFORWARD  Local Repository Updates No update ==[IDE]== Nov 19, 2012 10:28:18 PM Pushing finished. 

How can I fix this?

like image 669
user1592380 Avatar asked Nov 20 '12 03:11

user1592380


1 Answers

A non-fastforward push means the branch your are trying to push to diverged from the point your current branch is. In other words, there are new commits in your remote that you have to merge with to be able to push.

To achieve this, you can git pull in order to merge both branches, and then push the result, or you can do a git fetch and then a git rebase origin/master (or whatever names you put to your remote and HEAD branch) so your commits are applied on top of the remote branch. Then you can push the result, and that would be a fast-forward.

like image 137
mgarciaisaia Avatar answered Sep 19 '22 18:09

mgarciaisaia