Shanu k k
Shanu k k

Reputation: 1285

Bit bucket git bash issue

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://[email protected]/test/a.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'https://[email protected]/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?

Upvotes: 2

Views: 124

Answers (1)

Sajib Khan
Sajib Khan

Reputation: 24184

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

Upvotes: 2

Related Questions