I want make push and get error: src refspec master

2019-01-17 10:30发布

I'm hosting on Heroku. I want to make a push:

git push master Heroku

I gets the message:

error: src refspec master does not match any.
error: failed to push some refs to 'git@heroku.com: etc ...'

10条回答
冷血范
2楼-- · 2019-01-17 11:11

This is work for me:-

git push heroku HEAD:master
查看更多
劫难
3楼-- · 2019-01-17 11:13

I have expericed the problem you have. I solved this problem like this

  1. make file whatever
  2. commit
  3. push

    $ touch readme
    
    $ git add .
    
    $ git commit -m "init"
    
    $ git push heroku master
    

I don't know why.

查看更多
看我几分像从前
4楼-- · 2019-01-17 11:13

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.

查看更多
老娘就宠你
5楼-- · 2019-01-17 11:17

This worked for me.

git config --global user.email "you@example.com"

git config --global user.name "Your Name"

查看更多
登录 后发表回答