git: rename local branch failed

I get into this issue too. The reason is that I didn’t have any commit on this git repository.

When I run the command git branch -M main. I get the following error message.

error: refname refs/heads/master not found
fatal: Branch rename failed

After I add my first commit by the following command, all things work.

git add .
git commit -m 'Init'

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)