[Git] Solve git branch -M main error: refname refs/heads/master not found

When initializing a github project

Follow the github prompts to execute

git branch -M main

 

Returns error:

error: refname refs/heads/master not found

 

solve:

first

git add.

git commit -m “init”

 

And then execute

git branch -M main

Read More:

Leave a Reply

Your email address will not be published. Required fields are marked *