I'd like to create a github repository and rename the main branch to master.
If I create a new repository on github and do
git init
git add README.md
git commit -m "first commit"
git branch -M master
I get
error: refname refs/heads/master not found
fatal: Branch rename failed
so I seem to somehow not understand git well enough. What's the issue here?
I must have gotten confused when I was playing around with the above. The following happens:
git init create the repository
git add README.md adds the file
git commit -m "first commit" adds the file to the master branch since that still default for git
so I never have to rename it in the first place. Now Github uses the default main, which can be changed in settings -> repositories on github.com