Cause 1 of 4
You created the repository locally and also initialised one on the host, so each has its own root commit.
Look at both histories first — git log --oneline HEAD and git log --oneline origin/main — so you know what you are joining. Then merge them deliberately: git pull origin main --allow-unrelated-histories. Expect conflicts in files that exist on both sides, such as README and .gitignore, and resolve them before committing.
Cause 2 of 4
The remote history was rewritten — squashed, filtered, or force-pushed over.
Confirm which side is authoritative before joining anything. If the remote is correct and your local commits are the strays, the cleanest route is a fresh git clone into a new directory, then copy your changed files across and commit them normally. Nothing is lost, because your old clone is still on disk.
Cause 3 of 4
The remote URL points at a different repository than you think.
git remote -v. Pasting the wrong repository URL produces exactly this error, since the two projects genuinely are unrelated. Correct it with git remote set-url origin <url>.
Cause 4 of 4
You ran git init inside a directory that was already meant to be a clone.
Check for the extra root commit with git log --oneline | tail -5. If the local repository holds nothing you need, move it aside — rename the folder rather than deleting it — and clone the remote fresh.