heroku open - no app specified

I've just created a simple Rails app using

rails new myapp

then created the heroku stack using:

heroku create --stack cedar 

But when I try opening the app on Heroku using:

heroku open

I get:

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

And this:

$ heroku open --app myapp

gives me this:

 !    App not found

Am I missing something obvious?


If you have an existing app on Heroku and you are getting this no app specified message, you can correct it by running this on your local terminal:

heroku git:remote -a MyHerokuAppName


Heroku by default is not creating app with your directory name, so when you do

heroku create --stack cedar
Creating calm-bayou-3229... done, stack is cedar
http://calm-bayou-3229.herokuapp.com/ | [email protected]:calm-bayou-3229.git

it is creating application named 'calm-bayou-3229' And you can do

heroku open --app calm-bayou-3229
Opening http://calm-bayou-3229.herokuapp.com/

You can always list your apps with:

heroku apps

Another approach to solving the issue is to take a broad understanding of what the .git/config file associated with the heroku app is doing and make the necessary tweaks.

1.Open .git/config from your heroku project's root.

Your git config file may look something like this, especially if you are juggling a couple heroku accounts on your machine.

git@heroku.{heroku.account} shows up instead of [email protected] because of the configuration in your ~/.ssh/config file. The reference to heroku-app-8396.git should be updated to match your heroku project name. Each heroku account you have should have an entry in the ~/.ssh/config file. Obviously, the heroku account that this heroku project is associated with should show up in your .git/config file.

[core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    logallrefupdates = true
    ignorecase = true
    precomposeunicode = false
[remote "origin"]
    fetch = +refs/heads/*:refs/remotes/origin/*
    url = [email protected]:heroku-app-8396.git
[remote "heroku"]
    fetch = +refs/heads/*:refs/remotes/heroku/*
    url = [email protected]:heroku-app-8396.git
[branch "master"]
    remote = origin
    merge = refs/heads/master
[heroku]
  account = heroku.account

2.When I run git pull heroku master, all seems to run well.

3.When I run heroku logs, I get an error message:

$ heroku ps
!    No app specified.
!    Run this command from an app folder or specify which app to use with --app APP.

Why?

As far as I can tell, the heroku command doesn't seem to know what to do with the {heroku.account} references. If we change those references to com (which is the default value when you are not using the 'accounts' heroku plugin), the heroku commands work once again, but now our git calls are saying there is a different problem:

$ git pull heroku master

 !  Your key with fingerprint d6:1b:4c:48:8c:52:d4:d6:f8:32:aa:1a:e7:0e:a2:a1 is not authorized to access smooth-robot-8396.

fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

One way to resolve this is to define a remote for git and a remote for heroku and then tell heroku which remote to use.

[core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    logallrefupdates = true
    ignorecase = true
    precomposeunicode = false
[remote "origin"]
    fetch = +refs/heads/*:refs/remotes/origin/*
    url = [email protected]:heroku-app-8396.git
[remote "heroku"]
    fetch = +refs/heads/*:refs/remotes/heroku/*
    url = [email protected]:heroku-app-8396.git
[remote "heroku-app"]
    fetch = +refs/heads/*:refs/remotes/heroku/*
    url = [email protected]:heroku-app-8396.git
[branch "master"]
    remote = origin
    merge = refs/heads/master
[heroku]
    remote = heroku-app
    account = heroku.account

I like to explicitly specify the remote when I'm pushing content to a remote, so the heroku remote is for that, even though this configuration also accommodates pushing/pulling using the default (e.g., git push). I create a new remote 'heroku-app' and add remote = heroku-app to tell heroku to use a remote that doesn't include the heroku account in the URI.

Now I can run my git and heroku commands as I want to.


I had the same issue, All I had to do was cd to project dir instead of running commands from model folder in the project dir.