2

I am trying to git push from my local repo (TEST) to remote branch (TEST-tapariak) using following command:

git push origin TEST:TEST-tapariak

I am getting following error:

To ssh://git.example.com:2222/pkg/PARISService
 ! [rejected]        TEST -> TEST-tapariak (non-fast-forward)
error: failed to push some refs to 'ssh://git.example.com:2222/pkg/PARISService'
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.

I saw similar question and did git pull --rebase, git pull --rebase origin TEST, and git pull --rebase origin TEST-tapariak but didn't work for me.

Can anyone guide me how to resolve this?

animuson
  • 50,765
  • 27
  • 132
  • 142
  • It seems like there are commits on the `Test-tapariak` branch that are not local. Run this git log command `git log --pretty=oneline --abbrev-commit --all` look to see if the branches are out of sync. (Some one may have committed to the remote branch without you knowing) – Stefan Collier Oct 04 '17 at 09:08
  • Try `git pull --rebase origin TEST-tapariak:TEST` first. – ElpieKay Oct 04 '17 at 09:20

5 Answers5

3

use this command to upload full project forcefully,

git push -u origin master -f
1

hint: (e.g. 'git pull ...') before pushing again.

Pull remote TEST-tapariak branch into local TEST branch first, then Push.

$ git pull origin TEST-tapariak
$ git push origin TEST:TEST-tapariak 
Sajib Khan
  • 18,145
  • 4
  • 50
  • 65
  • when i do git pull: From . * branch TEST-tapariak -> FETCH_HEAD Already up-to-date –  Oct 04 '17 at 09:07
  • I guess, For `git pull` it tries `git pull origin TEST` because it is tracking remote branch `TEST`, not `TEST-tapariak`. So, `git pull origin TEST-tapariak` should run actually. Does it work? – Sajib Khan Oct 04 '17 at 09:16
0

Go to master do git pull then comeback to your branch and do: git rebase -i master If there are any conflicts:

  1. Resolve them
  2. Do git add --all
  3. Then git rebase --continue

Finally do git push

prisoner_of_azkaban
  • 554
  • 1
  • 4
  • 20
0

Can you do the following:

git pull --rebase origin TEST-tapariak

And finally,

git push origin TEST:TEST-tapariak
anothernode
  • 4,369
  • 11
  • 37
  • 53
0

In my case what I was doing wrong was trying to push to the gh-pages branch from my master branch.

git checkout -b gh-pages

This worked for me. Just saying, this simple thing could also be the case.