xxxxxxxxxx
git checkout master # to be sure you are on master branch
git push origin HEAD:main # and then push the current branch (as master) to main
xxxxxxxxxx
# Rename the branch locally
git branch -m master main
# Push the renamed branch to the remote repository
git push -u origin main
# Update the remote repository's default branch to "main"
git remote set-head origin -a