Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Problema when try push local repository to remote - git

pereiracinthiag April 8, 2019

When I run  git push origin <branch>

I have the error bellow:

$ git push origin <branch>
To https://bitbucket.org/folder.git
! [rejected] <branch> -> <branch> (non-fast-forward)
error: failed to push some refs to 'https://me@bitbucket.org/folder.git'
hint: Updates were rejected because a pushed branch tip is behind its remote
hint: counterpart. Check out this branch and integrate the remote changes
hint: (e.g. 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

 

When I run: git remote show origin

 

Local refs configured for 'git push':
<branch> pushes to <branch> (local out of date)

 

 

4 answers

1 accepted

0 votes
Answer accepted
pereiracinthiag April 10, 2019

Thanks for all the comments and help.

What happened was that there was commits in the remote master/origin.

Then I had to merge it into the branch I was working on. I did this by bitbucket website.

Locally I had to type the command: git branch --set-upstream-to=origin/<branch-name(remote)> <branch-name(local)>

 

Then, I could run push without problems.

0 votes
bci-pmontec
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 9, 2019

Cinthia

 

You try to execute this command:

 

git push -f origin <branch>

 

Regards.

0 votes
pereiracinthiag April 8, 2019

Thanks for your answer.

I already tryed git pull. But still have the issue.

0 votes
John Lawlor
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 8, 2019

Your branch is behind the upstream branch. Try doing:

 

git pull

 

and then do your push.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events