I\'m hosting on Heroku. I want to make a push:
git push master Heroku
I gets the message:
error: src refspec master does no
Just adding an answer which is to the point of the question
You are facing this error because Git create master branch only after commit to your local repo. If you just initialize repo then there is no master.
So how do you fix it?
Just add and commit at least one change to your repo and re-run push command. You can add and commit a simple .gitignore file as well likewise stated in other answers
Try this:
git push heroku main
Source here
I came here after following the step-by-step guide of heroku. To me the problem was solved after creating minimum a file in the repository, committing it and then pushing to heroku again.
I got this error when trying to push to Heroku when I wasn't on my local master branch.
I resolved it with
git push heroku my_branch_name:master
and replacing my_branch_name
with the name of the git branch I was on. I think this tells Heroku to receive this local branch on Heroku's master branch.
actually, i needed to create a file, otherwise commit was empty.
touch readme.md
if you are writing ->
"git push master Heroku"
and getting error like->
error: src refspec master does not match any. error: failed to push some refs to 'git@heroku.com: etc'
then first type in hyper->
git commit -m 'Initial commit'
and then if there is an error like
email ,name is not found or something like that
then it might be possible that you could'nt sign in heroku page.
first write type in hyper commond line or whatever cmd line you are using
git config --global user.email "yourgmail address"
then hit enter then type
git config --global user.name "Your Name"
then it will work fine. if you want to check that it is working fine then type
git commit -m 'initial commit'
it will take sometime and then write code
git push heroku master
-------------------------Now everything is solved-TADADAAAA-------------------------- Note-Please write your email address and username in above code...