rayray
rayray

Reputation: 931

Heroku toolbelt command requires app-name

How do you specify the app you want when you log in to Heroku from the command line?

I was trying to check the logs so when I first logged in I tried:

Heroku logs

this then told me:

 !    No app specified.
 !    Run this command from an app folder or specify which app to use with --app <app name>

I then tried:

heroku --app my-appname

but i get:

`--app` is not a heroku command.

I have tried all combinations.

Upvotes: 45

Views: 30693

Answers (7)

Mustapha-Belkacim
Mustapha-Belkacim

Reputation: 1831

Heroku CLI automatically detects the app name by scanning the git remotes for the current working copy.

If you're not in the app's local git clone, you need to specify the app name:

heroku logs --app app-name 

or

heroku logs -a app-name 

or by specifying the remote name:

heroku logs --remote production

You can reference this part of the Heroku documentation:

https://devcenter.heroku.com/articles/using-the-cli#app-commands

Upvotes: 2

Erion S
Erion S

Reputation: 1633

Try this:

heroku git:remote -a [app_name]

This should allow you to call commands without having to specify which app you want them to be called on.

Upvotes: 25

Pragmateek
Pragmateek

Reputation: 13408

From my tests the Heroku CLI will infer the app from the current Git remote.

So to change to the "test" app:

git config heroku.remote test

And to come back to the default "heroku" application, which is probably your production app:

git config heroku.remote heroku

Not sure this is a good idea though...

Upvotes: 0

Risul Islam
Risul Islam

Reputation: 806

For future solution seekers-

The error says a possible solution.

Run this command from an app folder

cd to the app directory root, then run your desired command.

Upvotes: -1

You could try adding --app app-name after you sentence.

Example: $ heroku domains:add your-domain --app app-name

Upvotes: 2

Francesc Rosas
Francesc Rosas

Reputation: 6055

Another option is to associate your (git) project to Heroku. From heroku open - no app specified:

$ cd app-dir
$ heroku git:remote -a app-name
$ heroku logs

Upvotes: 49

redhotvengeance
redhotvengeance

Reputation: 27886

You still need to include the command:

heroku logs --app app-name

You can also use -a instead of --app:

heroku logs -a app-name

Upvotes: 59

Related Questions