git refname refs heads master not found 2020-12-17 01:51
I encountered this error while creating a repository on Github.
$ git branch -M main
error: refname refs/heads/master not found
fatal: Branch rename failed
This error occurs because Github has changed the default branch from master to main.
The correct way to init empty repository is as follows.
git remote add origin git@github.com:<YOUR_REPOSITORY_ADDRESS>
git add .
git commit -m "first commit"
git branch -M main
git push -u origin main
EOF