Multiple apps in git remotes when trying to access rails console

user1670773 picture user1670773 · Dec 11, 2015 · Viewed 8.5k times · Source

I have two git branches, staging and production, and I deployed them on Heroku in the same Heroku acccount. Suppose my app names are app1.heroku-app.com and app2.heroku-app.com and the remote names are heroku-staging and heroku-production,respectively. I deployed both apps on Heroku. After I login to Heroku from the console using heroku login and then try to access a Rails console using heroku run rails c, I get this message :

 ▸    multiple apps in git remotes
 ▸    remotes: heroku-staging heroku-production

How can I access a console?

Answer

Kristján picture Kristján · Dec 11, 2015

If there's only one Heroku remote, heroku can infer which you want. When there are multiple (or if you want to access an application that doesn't have a remote in this Git repo, or when you're not in a Git repo at all), you need to use the --app option to specify which application you want a console on.

$ heroku --help
Usage: heroku COMMAND [--app APP] [command-specific-options]

$ heroku run rails c --app app1
$ heroku run rails c --app app2