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

后端 未结 16 1977
梦如初夏
梦如初夏 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:53

    This worked for me.

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

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

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

    The error on my terminal "testpry git:(ft-heroku-deployment-170679745) git push heroku master error: src refspec master does not match any. error: failed to push some refs to 'https://git.heroku.com/guarded-taiga-41995.git'"

    Solution: You need to check the name of the branch you are working on. In this case, it is "ft-heroku-deployment-170679745"

    The right push command is $ git push heroku ft-heroku-deployment-170679745

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

    At first glance it looks like you have got your master and Heroku parameters round the wrong way because the first parameter to git push should be the name of the remote repository, the second is refspec (normally a branch). You are more likely to have a branch called master and a remote called Heroku. But I would expect you to get a different error message if that were the case, something like:

    fatal: 'master' does not appear to be a git repository
    fatal: Could not read from remote repository.
    

    The error message you are seeing implies that there is no local master branch. That would be the case if you haven't made any commits yet because git doesn't create the branch until the first commit. You can check this by running:

    git show-ref
    

    You should see a line containing refs/heads/master if you have a master branch. If not then try running:

    git commit -m 'Initial commit'
    

    You can also find out what remotes you have available with:

    git remote -v
    

    If you have a remote called Heroku you should see something like:

    Heroku  git@heroku.youraccount:yourproject.git (fetch)
    Heroku  git@heroku.youraccount:yourproject.git (push)
    
    0 讨论(0)
  • 2020-12-02 12:58

    This is work for me:-

    git push heroku HEAD:master
    
    0 讨论(0)
提交回复
热议问题