如何使用 Heroku CLI 连接到选定的应用

12

我正在尝试在Heroku上部署我的Java Web应用程序。在制作教程时,我使用 heroku create 命令创建了一个名为“name-app1”的应用程序。然后,我在教程结束后将其删除,并创建了一个新的应用程序以进行部署,假设它名为:“new_app”。但是,当我尝试上传我的代码时,出现了错误,指示之前的应用程序“name-app1”不再存在。当我尝试使用例如heroku logs时,会出现以下错误:

 »   Error: Missing required flag:
 »     -a, --app APP  app to run command against
 »   See more help with --help

我试图使用以下命令指向我的新应用程序:

git remote set-url heroku git@heroku.com:hidden-ridge-8790.git

我觉得我弄错了什么,不知道如何修复。

3个回答

40

你尝试设置Heroku的远程方式是不正确的,这就是为什么会出现上述错误的原因。 要正确设置您的远程,请使用以下命令

heroku git:remote -a new_app

这将把您的远程设置为新创建的应用程序new_app

要部署代码,请使用以下命令

git push heroku master

这将把您的代码部署到Heroku应用程序


4

你离成功很近了,

heroku git:remote -a hidden-ridge-8790

与以下命令相同:

git remote add heroku git@heroku.com:hidden-ridge-8790.git

请尝试以上命令,如果无效,请展示git remote -v的输出内容,我们会帮助您解决问题。


2

试一下这个

heroku git:remote -a 你的本地应用名称

heroku run rails c


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接