git checkout main
git rebase -i --root
This opens an editor showing all commits. Change pick to squash (or s) for all commits except the first one. Save and close the editor, then write a new commit message.
git push origin main --force-with-lease
likely you need then