I created local git repo. (git init, git add, git commit). Then I created git repo on Azure DevOps.
I also executed locally git remote add origin <azure_repo_url>
Now when I try git push origin master
I get back:
To azure_repo_url
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'azure_repo_url'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
So I tried pull
first: git pull origin master
but got back:
$ git pull origin master
warning: no common commits
remote: Azure Repos
remote: We noticed you're using an older version of Git. For the best experience, upgrade to a newer version.
remote: Found 3 objects to send. (27 ms)
Unpacking objects: 100% (3/3), done.
From azure_repo_url
* branch master -> FETCH_HEAD
* [new branch] master -> origin/master
fatal: refusing to merge unrelated histories
I can solve it by git pull origin master --allow-unrelated-histories
from here so,
but I wonder if there is cleaner way to do it?