heroku open - no app specified
Asked Answered
P

5

58

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?

Pembrook answered 18/9, 2012 at 15:1 Comment(2)
You no longer have to specify the cedar stack, it is the default nowRookie
Make sure to scroll down past the first couple answers. This one is the best.Conformance
U
129

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

Unorthodox answered 18/7, 2014 at 2:18 Comment(1)
This is exactly what I needed. I use auto-deploys from a git branch. For an unrelated reason I needed to form a new repo. This was exactly what I needed to fix that. Also, when I wanted to interact with heroku from a different machine (actually a cloud9 dev environment), this simple command let me connect and work with heroku.Furfuran
P
26

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
Purine answered 18/9, 2012 at 15:31 Comment(0)
B
20

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.

Belonging answered 15/2, 2013 at 17:34 Comment(1)
Could you provide an example of your ~/.ssh/config? Also an example of how you push to heroku would be helpful. I tried following your example but was unable to resolve the issue.Nerti
M
6

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.

Module answered 15/12, 2014 at 2:17 Comment(0)
I
2

This crazy thing worked for me:

If you have the app's git repo copy on you local machine then cd to that location and that's it!!

You will be able to use the app. You can verify this by commands like: heroku logs -n 1500

Interweave answered 30/9, 2017 at 14:26 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.