Few months back, Github changed the default branch from master to main. Due to this change, most of the projects were forced migrate from master to main branch. Recently I faced this problem for one of my projects.
After multiple trials and errors, I successfully migrated my project to main branch. I would like to share the steps and it would help you when you face the similar problem in the future.
git remote add origin <remote_github_url>
git pull origin main
git branch -m master main
git add . git commit -m "master branch changed to main"
git push --set-upstream origin main
Now all your changes will be available in the remote main branch.
NOTE: Backup your source code before you do all these changes.