March 2021, with Git 2.31:
A git clone of an empty GitHub repository will create a local repository with 'main' as a default branch, even if init.defaultBranch is set on master!
The Git transfert protocol v2, supported by GitHub, will communicate to the client the name of the remote default branch (now main for GitHub) to the local Git repository created by git clone.
That means adding and committing new commits will be done on 'main' branch, even if the Git client still consider master as the default branch.
No more "src refspec master does not match any." on your next push.
my suggestion is, after using these codes:
git init git remote add origin <your-repo-url>
clone your repo by this code:
git clone <your repo url>
then cd repo-folder and copy the .git and all content to your main directory (cd ..) and delete the repo-folder. Now you can add, commit and push your files.
git addwith dot or some files this error also will appear.