This was just a note for myself because sometimes I start creating a project locally before creating an online repository in Bitbucket. I usually just create a repo in Bitbucket having the .gitignore file added by default.
Run the following git command to add the remote url.
git remote add origin https://OmelSoft@bitbucket.org/OmelSoft/myproject.git
Now, I wanted to merge the histories in the remote repository when it’s initially created to my local repository. To prevent git throwing the error “fatal: refusing to merge unrelated histories“, I used the following command to force the merge to happen.
git pull origin master --allow-unrelated-histories