Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.3k views
in Technique[技术] by (71.8m points)

git - Push to Heroku denied - "failed to push some refs to 'heroku"

I should start by saying I'm totally new to Heroku, and it's all looking pretty to foreign to me right now.

Anyway, I've done the Heroku getting started tutorial, uploading a clone git repo, and this works fine.

I'm now trying to accomplish this with some of my own code, but struggling.

  1. First, I go to my app directory in bash.
  2. Then I run heroku create. This is successful.
  3. I then run git push heroku master as instructed in the tutorial, and I receive the following errors:

error: src refspec master does not match any.

error: failed to push some refs to 'heroku'

Would appreciate if someone can explain what I am missing here? Thanks in advance.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

It seems that you have not initiated your master branch properly. Have you commited your files? Try (assuming you are on master branch):

git add .
git commit -m "First commit"
git push heroku master:master

Another, more direct approach, is to push the HEAD:

git push heroku HEAD:master

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...