These two steps worked for me!
Step 1:
git remote set-url origin https://github.com/username/example_repo.git
Step 2:
git push --set-upstream -f origin main
Step 3:
your username and password for github
On step 2, -f
is actually required because of the rebase, quote from this post.