首页 > 解决方案 > 当我在这里尝试在 git bash 中 git push heroku 时出错

问题描述

我使用 node.js 制作了一个不和谐的机器人。我正在尝试在Heroku. 我git bash here在我的机器人文件夹中打开了一个。我已经完成了,git add .添加了一个文件。如果您能提供帮助,将不胜感激。Procfile.gitignore

git commit -m "First commit". 之后,我尝试做git push heroku. 我得到了这个错误。

fatal: The current branch master has no upstream branch.
To push the current branch and set the remote as upstream, use

    git push --set-upstream heroku master
'

在我这样做之后,git push --set-upstream heroku master我得到另一个错误说,

error: src refspec master does not match any.
error: failed to push some refs to 'https://git.heroku.com/japan-service-helper.git'

我希望它上传到heroku。

标签: githeroku

解决方案


在将代码推送到 Heroku 之前,您需要

  1. 注册 Heroku,
  2. 通过 Web 界面或运行在 Heroku 上创建应用程序

    heroku create <optional-app-name>
    
  3. 通过添加远程. heroku create通常会为您执行此操作,但看起来您还没有heroku遥控器。您可以通过运行添加一个

    heroku git:remote -a <name-of-existing-heroku-app-to-use>
    

完成后,您应该有一个名为heroku. 通过运行验证git remote -v,然后git push heroku从您的master分支继续。


推荐阅读