I want make push and get error: src refspec master does not match any

后端 未结 16 1978
梦如初夏
梦如初夏 2020-12-02 12:16

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         


        
相关标签:
16条回答
  • 2020-12-02 12:38

    I experienced the same issue. For me the problem occurred because I hadn't signed into git correctly. Before you can push code to the master branch, you must have first made your initial commit with the command git commit -m "My first commit". You may have gotten this response when trying to do that (like I got):

    git: fatal unable to auto-detect email address (got "some wrong email").

    If that was the response you got, you must now enter your desired git email and username with the commands:

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

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

    After you've done that, try the push command again

    git push heroku master

    It should work now.

    0 讨论(0)
  • 2020-12-02 12:39

    This is a late answer, but might help someone.

    instead of this:

    git push master Heroku
    

    try:

    git push heroku master
    
    0 讨论(0)
  • Come in late but in my case:

    git push git@heroku.com:appname.git master

    did the trick for me! With appname being the name of your heroku app

    0 讨论(0)
  • 2020-12-02 12:40

    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.

    0 讨论(0)
  • 2020-12-02 12:43

    First push your changes to the remote branch before pushing to heroku

    git push origin master
    git push heroku master 
    

    If you want to push a branch which is not the master branch to heroku

    git push origin development_branch
    git push heroku development_branch:master
    
    0 讨论(0)
  • 2020-12-02 12:45

    In my case, this happened because I had nothing to push. I had forgotten to do a "git add" first. As soon as I did a "git add" then "git commit" for actual content, the push worked fine.

    0 讨论(0)
提交回复
热议问题