Script below is what I've used to industrialise moving from a 'master' branch to 'main' both locally and remotely.
Have a local Github authentication token set in environment variable GIT_TOKEN
Assumes you have a repo with more than 1 commit, and a local master
branch tracking a remote master
branch.