Bored to write app name in every heroku command though I got only 1 app [duplicate]
Asked Answered
C

6

17

Heroku toolbelt is always forcing me to write an app name at the end like this:

heroku pg:reset DATABASE --app [app_name]

Is there a way to set the default app to which all my CLI heroku commands will apply?

Compare answered 9/7, 2013 at 18:1 Comment(0)
I
19

If heroku is claiming that there are multiple apps in the folder you must have more than one remote in your .git/config.

Remove the extra heroku remote or set the default using git config heroku.remote remote_name

Imperception answered 9/7, 2013 at 19:36 Comment(2)
Any solution for non-git apps (e.g. for container stack)?Ted
This did not work for me. I had to remove the git/config lines generated from this and use git remote add heroku [email protected]:[heroku-app-1234].git insteadFlats
P
32

Going to post this just in case it helps someone else out. I had the same problem even though there was only one app installed. I had to switch my heroku remote url from https to git.

https://git.heroku.com/[heroku-app-1234].git

to

[email protected]:[heroku-app-1234].git

Then everything worked normally for myself.

git remote remove heroku
git remote add heroku [email protected]:[heroku-app-1234].git
Pr answered 23/1, 2015 at 2:11 Comment(1)
This worked where as the accepted answer did notFlats
I
19

If heroku is claiming that there are multiple apps in the folder you must have more than one remote in your .git/config.

Remove the extra heroku remote or set the default using git config heroku.remote remote_name

Imperception answered 9/7, 2013 at 19:36 Comment(2)
Any solution for non-git apps (e.g. for container stack)?Ted
This did not work for me. I had to remove the git/config lines generated from this and use git remote add heroku [email protected]:[heroku-app-1234].git insteadFlats
E
1

If you have the heroku-accounts plugin installed, switching to the heroku branch worked for me, as discussed in this answer.

To swap out your existing version of the heroku-accounts plugin, use:

heroku plugins:install https://github.com/heroku/heroku-accounts.git

Note that if you've followed @Moemars answer, you'll need to switch your git remote back to https.

Evangelistic answered 29/4, 2015 at 22:23 Comment(0)
P
0

If you run heroku from the Git repo linked to your Heroku app, you don't have to specify an app name (unless the repo is connected to multiple apps).

Pointtopoint answered 9/7, 2013 at 18:7 Comment(1)
I'm initiating all commands from my rails app root directory (which is a git repo linked with github and heroku) and that's what it says: ! Multiple apps in folder and no app specified. ! Specify app with --app APP. BTW: I have only one app in dashboard.heroku.com/appsCompare
P
0

This seems to be the easiest way to fix the issue:

heroku git:remote -a <app_name>
Penley answered 30/1, 2021 at 9:48 Comment(0)
M
0

Since this wasn't mentioned until now:

Apart from the git remote, the Heroku CLI also looks into the HEROKU_APP environment variable.

By using direnv, dotenv or similar tools for project-specific environments you can easily set the respective Heroku app for each project or directory.

Makeup answered 1/5, 2021 at 7:31 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.