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

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

    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

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

    Try this:

    git push heroku main

    Source here

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

    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.

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

    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.

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

    actually, i needed to create a file, otherwise commit was empty.

    touch readme.md
    
    0 讨论(0)
  • 2020-12-02 12:38

    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...

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