heroku open - no app specified

Ruby on-RailsHeroku

Ruby on-Rails Problem Overview


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?

Ruby on-Rails Solutions


Solution 1 - Ruby on-Rails

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

Solution 2 - Ruby on-Rails

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

Solution 3 - Ruby on-Rails

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.

Solution 4 - Ruby on-Rails

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.

Solution 5 - Ruby on-Rails

>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

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionSnowcrashView Question on Stackoverflow
Solution 1 - Ruby on-RailsAaron GrayView Answer on Stackoverflow
Solution 2 - Ruby on-RailsMarcin OlichwirowiczView Answer on Stackoverflow
Solution 3 - Ruby on-RailsDavid VezzaniView Answer on Stackoverflow
Solution 4 - Ruby on-RailsRichardlonesteenView Answer on Stackoverflow
Solution 5 - Ruby on-RailsxameeramirView Answer on Stackoverflow