git Heroku 推送应用问题

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6447081/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 05:36:11  来源:igfitidea点击:

Heroku push app problem

githeroku

提问by Paul

I installed Heroku and set up an account, but for some reason whenever I try to push the app to the site, I get this error.

我安装了 Heroku 并设置了一个帐户,但是由于某种原因,每当我尝试将应用程序推送到该站点时,都会出现此错误。

$ git push heroku master
!  No such app as first_app
fatal: The remote end hung up unexpectedly

I have checked to see that heroku sees the git

我已经检查过 heroku 看到了 git

$ git remote -v
heroku  [email protected]:first_app.git (fetch)
heroku  [email protected]:first_app.git (push)

how do I get heroku to recognize my git file?

我如何让 heroku 识别我的 git 文件?

回答by glarkou

It seems that you have renamed your application.

您似乎已重命名您的应用程序。

If you have renamed you application just follow the instructions here:

如果您已重命名您的应用程序,只需按照此处的说明进行操作:

http://devcenter.heroku.com/articles/renaming-apps#updating-git-remotes

http://devcenter.heroku.com/articles/renaming-apps#updating-git-remotes

Follow: Updating Git remotespart if you updated your application through the Heroku Web Interface!

遵循:如果您通过 Heroku Web 界面更新了应用程序,则更新 Git 远程部分!

回答by actraub

If you are using the CLI to rename an app from inside the Git checkout directory, your remote will be updated automatically. If you rename from the website or have other checkouts, such as those belonging to other developers, these will need to be updated manually:

如果您使用 CLI 从 Git checkout 目录中重命名应用程序,您的遥控器将自动更新。如果您从网站重命名或有其他结帐,例如属于其他开发人员的结帐,则需要手动更新这些:

$ git remote rm heroku
$ heroku git:remote -a newname

回答by knappen

Here is a step-by-step for first timers to rename your app in git to match it's new heroku name. It also includes slightly different terminal inputs than others have noted here.

这是初学者在 git 中重命名您的应用程序以匹配它的新 heroku 名称的分步指南。它还包括与此处提到的其他人略有不同的终端输入。

  1. open terminal and navigate using

    • cd ..to get back to the main directory and

      cd *dev_folder*/*app_folder*to navigate into the proper folder

    • dev_folderand app_folderwill be the actual names of the folders where you file your applications

    • your shell prompt in terminal will now be

      user_name@computer_name:~/dev_folder/app_folder$

  2. remove the current heroku association by typing after the $ prompt:

    git remote rm heroku

  3. open your browser and log into heroku

  4. on heroku click on "MyApps" in the top navigation bar

  5. on heroku click on the application you want to associate with your local directory

  6. on heroku click the "Settings" icon that looks like gears

  7. on heroku scroll down the settings page until you find the "Info" section

  8. on heroku copy your Git URL, [email protected]:yourappname.git, from the Info section

  9. go back to your terminal

  10. add your new heroku app name by typing in terminal after the $ prompt:

    git remote add heroku (paste your git url)

    your full prompt will look like:

    user_name@computer_name:~/dev_folder/app_folder$ git remote add heroku [email protected]:*yourappname*.git

  11. all done, try to push
  1. 打开终端并使用导航

    • cd ..回到主目录和

      cd *dev_folder*/*app_folder*导航到正确的文件夹

    • dev_folderapp_folder将是您提交应用程序的文件夹的实际名称

    • 您在终端中的 shell 提示现在将是

      user_name@computer_name:~/dev_folder/app_folder$

  2. 通过在 $ 提示符后键入来删除当前的 heroku 关联:

    git remote rm heroku

  3. 打开浏览器并登录heroku

  4. 在 heroku 上点击顶部导航栏中的“MyApps”

  5. 在 heroku 上单击要与本地目录关联的应用程序

  6. 在heroku上点击看起来像齿轮的“设置”图标

  7. 在 heroku 上向下滚动设置页面,直到找到“信息”部分

  8. 在 heroku 上复制你的 Git URL,[email protected]: yourappname.git,从信息部分

  9. 回到你的终端

  10. 通过在 $ 提示符后输入终端来添加新的 heroku 应用程序名称:

    git remote add heroku (paste your git url)

    您的完整提示将如下所示:

    user_name@computer_name:~/dev_folder/app_folder$ git remote add heroku [email protected]:*yourappname*.git

  11. 全部完成,尝试推动

回答by Gal Bracha

It's a common rename problem.

这是一个常见的重命名问题

you should go back to heroku and renameyour app to the old name

你应该回到 heroku 并将你的应用程序重命名为旧名称

and run the following command to give it a new name from console:

并运行以下命令从控制台给它一个新名称:

heroku apps:rename new_app_name

回答by Blazer

Try this line to restart en refresh Heroku!

试试这一行来重新启动和刷新 Heroku!

heroku restart

回答by John Beynon

Have you created the app on Heroku - via heroku create? Heroku create would setup the heroku git remote to the target repo on heroku.

您是否在 Heroku-via 上创建了该应用程序heroku create?Heroku create 会将 heroku git remote 设置为 heroku 上的目标存储库。

You can check by going to https://api.heroku.com/myappsand then finding the app in the list if it's already been created. If you may have renamed the application (or to check on the repo URL) click on the app name and it will show you the git repo address. Make sure this matches what you see from doing git remote -von your local machine.

您可以通过访问https://api.heroku.com/myapps进行检查,然后在列表中找到该应用程序(如果它已被创建)。如果您可能已重命名应用程序(或检查 repo URL),请单击应用程序名称,它会显示 git repo 地址。确保这与您git remote -v在本地机器上看到的相符。

回答by Ashwani Garg

Try to re-add the remote url.

尝试重新添加远程 url。

// Check for the current url 
git remote -v

// remove remote url
git remote rm heroku

// re-add the remote url
git remote add heroku [email protected]:boiling-inlet-6951.git