First set your email and username config using:
git config --global user.email “you@example.com”git config --global user.name “Your Name”
Then add your files:
git add .
Then make your first commit :
git commit -m "Initial commit"
And now run the command :
git branch -M main
It worked for me this way.