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.
- L0
Linh Mai Apr 21 2022
You can run command
git show-ref
1. if it returns
refs/heads/master
you can run commandgit push origin HEAD:master
2. if it returns
refs/heads/main
you can run commandgit push origin HEAD:main
I got the same error and solve by this way.
- M0
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
- M0
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?
* Type maximum 2000 characters.
* All comments have to wait approved before display.
* Please polite comment and respect questions and answers of others.