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
  • 53,861
  • 28
  • 137
  • 147
  • 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

6 Answers6

5

use this command to upload full project forcefully,

git push -u origin master -f
Maizied Hasan Majumder
  • 1,197
  • 1
  • 12
  • 25
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
  • 22,878
  • 9
  • 63
  • 73
  • 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
1

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
  • 700
  • 1
  • 8
  • 26
0

Can you do the following:

git pull --rebase origin TEST-tapariak

And finally,

git push origin TEST:TEST-tapariak
anothernode
  • 5,100
  • 13
  • 43
  • 62
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.

0

It should also be recommended to ensure GitHub is actually up before trying anything else. I encountered this issue during an outage and would use the following page to perform a quick check before trying anything else in future.

https://www.githubstatus.com/

Tim Cutting
  • 297
  • 1
  • 6
  • 14