Github error: src refspec master does not match any
Hello Guys, I have a project with .Net 6 and use GitHub to help manage source code. The first time I clone code to my local computer and I have added some features to the source code. Now I need to commit code, I try:
git add . git commit -m "Add more feature to project" git push origin master
But I got an error throw error: src refspec master does not match any.
error: src refspec master does not match any. error: failed to push some refs to 'xxxxx.com/xxx/xx/eco_coin.git'
I tried to git push it's worked for me. But I want to push directly to the origin not on local
I don't know how to fix it. Thank for any solution.
Linh Mai Apr 21 2022
You can run command
1. if it returns
refs/heads/masteryou can run command
git push origin HEAD:master
2. if it returns
refs/heads/mainyou can run command
git push origin HEAD:main
I got the same error and solve by this way.
Marry Christ Apr 21 2022
Not sure but maybe the branch is main instead of master
Please change to:
git push origin HEAD:main #or git push origin main
I hope it's work for you
Mohammed Waseem Apr 21 2022
I really got the same error, It's mean you have no branch name "master". You need to recheck what is the current branch name?