I have a project on my local which I want to share on Bitbucket. I created a repository on Bitbucket named "rest-api".
Now, I am into my IntelliJ IDEA IDE, and already added the project to git. I also added the project to the remote repository using IDEA.
Now, I am trying to push my project to remote, but that giving me error:
error: failed to push some refs to 'https://my@bitbucket.org/my/rest-api.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
To https://bitbucket.org/my/rest-api.git
! refs/heads/master:refs/heads/master [rejected] (non-fast-forward)
Done
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
I read some SO questions and learned that I need to first git pull
. So I tried that as well, but that also gave me the error:
Git Pull Failed
From https://bitbucket.org/my/rest-api
* branch master -> FETCH_HEAD
= [up to date] master -> origin/master
refusing to merge unrelated histories
What am I doing wrong?