0

I'm using sourceTree.

How can I push an existing local project (branch) to

a remote Gitbug repository I won?

I try and get this error:

git -c diff.mnemonicprefix=false -c core.quotepath=false push -v --tags --set-upstream memPic master:master 
Pushing to https://github.com/elad2109/memPic.git
To https://github.com/elad2109/memPic.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'https://github.com/elad2109/memPic.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Merge the remote changes (e.g. 'git pull')
hint: before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
Completed with errors, see above

but anyway I'm not sure what are the required steps?

RamonBoza
  • 8,898
  • 6
  • 36
  • 48
Elad Benda
  • 35,076
  • 87
  • 265
  • 471
  • Possible duplicate of http://stackoverflow.com/questions/10298291/cannot-push-to-github-keeps-saying-need-merge – thSoft Oct 24 '13 at 12:31

2 Answers2

2

This is not a github problem but a git problem. You can't make a non-fast-forward push without merging/rebasing. Please check the corresponding parts of the documentation.

This site is a great help for understanding the problem!

So you basically either have to git pull or git pull --rebase.

Adam Arold
  • 29,285
  • 22
  • 112
  • 207
0

This is failing because the tip of your branch is behind its remote. This might happen if there was a fetch without a rebase.

There are two ways to fix. To keep the remote changes add git rebase, before your command. To discard the other changes (not recommended) add a -f to your push command.

cforbish
  • 8,567
  • 3
  • 28
  • 32