2

Hi i am trying to update files from my local to bit bucket through Git Bash. When i try this commend

$ git push -u origin 'master'

I get an error like

To https://test@bitbucket.org/test/a.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'https://test@bitbucket.org/test/a.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

Please help me.I don't know why i am getting this error.I am beginner in git Bash and bit bucket.Please help me?

Shanu k k
  • 1,235
  • 2
  • 18
  • 43

1 Answers1

2

Your local/master is not update with remote/master. First Pull master then Push.

$ git pull origin master
$ git push -u origin master

If not work then try to rebase origin/master.

$ git pull --rebase origin master

As you mentioned (in comment), you have untracked files locally. Follow Add -> Commit -> Rebase -> Push.

$ git add .
$ git commit -m 'added all'
$ git pull --rebase origin master
$ git push origin master
Sajib Khan
  • 22,878
  • 9
  • 63
  • 73