Git Push Error: failed to push some refs to?

Viewed 21344

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?

5 Answers

use this command to upload full project forcefully,

git push -u origin master -f

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 

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

Can you do the following:

git pull --rebase origin TEST-tapariak

And finally,

git push origin TEST:TEST-tapariak

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.

Related