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?

John Denisov
  • 175
  • 1
  • 4

6 Answers6

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

git@heroku.com:[heroku-app-1234].git

Then everything worked normally for myself.

git remote remove heroku
git remote add heroku git@heroku.com:[heroku-app-1234].git
Moemars
  • 4,692
  • 3
  • 27
  • 30
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

Lukas Eklund
  • 6,068
  • 1
  • 32
  • 33
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.

Community
  • 1
  • 1
rcoup
  • 5,372
  • 2
  • 32
  • 36
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).

mipadi
  • 398,885
  • 90
  • 523
  • 479
  • 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/apps – John Denisov Jul 09 '13 at 18:52
0

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

heroku git:remote -a <app_name>
BitOfUniverse
  • 5,903
  • 1
  • 34
  • 38
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.

Denis Cornehl
  • 4,104
  • 1
  • 20
  • 24