Every time I create a new blank project in GitHub and I try and merge in my local project to that new project I would do a git pull on the main repository while also being on main on my local.
git pull origin main
I often come across this error when trying to merge the origin main and local main branches.
To fix add the --allow-unrelated-histories flag to git pull.
git pull origin main --allow-unrelated-histories
Here is the result with the command.
At this point it’s a matter of fixing the merge conflict and then pushing the new change back to origin to add the new project files to GitHub.