我刚刚使用
创建了一个简单的Rails应用程序rails new myapp
然后使用:
创建了heroku堆栈heroku create --stack cedar
但是当我尝试使用Heroku在Heroku上打开应用程序时:
heroku open
我明白了:
! No app specified.
! Run this command from an app folder or specify which app to use with --app <app name>
而且:
$ heroku open --app myapp
给了我这个:
! App not found
我错过了一些明显的东西吗?
答案 0 :(得分:124)
如果您在Heroku上有一个现有的应用程序并且您没有收到应用程序指定的消息,则可以通过在本地终端上运行此消息进行更正:
heroku git:remote -a MyHerokuAppName
答案 1 :(得分:25)
Heroku默认情况下不会使用您的目录名创建应用程序,所以当您执行
时heroku create --stack cedar
Creating calm-bayou-3229... done, stack is cedar
http://calm-bayou-3229.herokuapp.com/ | git@heroku.com:calm-bayou-3229.git
正在创建名为'calm-bayou-3229'的应用程序 你可以做到
heroku open --app calm-bayou-3229
Opening http://calm-bayou-3229.herokuapp.com/
您随时可以使用以下网址列出您的应用:
heroku apps
答案 2 :(得分:19)
解决此问题的另一种方法是广泛了解与heroku应用程序关联的.git / config文件正在执行的操作并进行必要的调整。
1.打开heroku项目根目录中的.git/config
。
您的git配置文件可能看起来像这样,特别是如果您在计算机上处理几个heroku帐户。
由于git@heroku.{heroku.account}
文件中的配置, git@heroku.com
显示而不是~/.ssh/config
。应更新对heroku-app-8396.git
的引用以匹配您的heroku项目名称。您拥有的每个heroku帐户都应在~/.ssh/config
文件中有一个条目。显然,与此heroku项目相关联的heroku帐户应显示在.git/config
文件中。
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
precomposeunicode = false
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = git@heroku.heroku.account:heroku-app-8396.git
[remote "heroku"]
fetch = +refs/heads/*:refs/remotes/heroku/*
url = git@heroku.heroku.account:heroku-app-8396.git
[branch "master"]
remote = origin
merge = refs/heads/master
[heroku]
account = heroku.account
2.当我跑git pull heroku master
时,一切似乎都运行良好。
3.当我运行heroku logs
时,收到错误消息:
$ heroku ps
! No app specified.
! Run this command from an app folder or specify which app to use with --app APP.
为什么?
据我所知,heroku
命令似乎不知道如何处理{heroku.account}
引用。如果我们将这些引用更改为com
(这是您未使用'accounts'heroku插件时的默认值),heroku
命令会再次运行,但现在我们的git
调用正在说有一个不同的问题:
$ 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.
解决此问题的一种方法是为git
定义一个遥控器,为heroku
定义一个遥控器,然后告诉heroku
使用哪个遥控器。
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
precomposeunicode = false
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = git@heroku.heroku.account:heroku-app-8396.git
[remote "heroku"]
fetch = +refs/heads/*:refs/remotes/heroku/*
url = git@heroku.heroku.account:heroku-app-8396.git
[remote "heroku-app"]
fetch = +refs/heads/*:refs/remotes/heroku/*
url = git@heroku.com:heroku-app-8396.git
[branch "master"]
remote = origin
merge = refs/heads/master
[heroku]
remote = heroku-app
account = heroku.account
我喜欢在将内容推送到远程时明确指定远程,因此heroku
远程用于此,即使此配置也适用于使用默认值的推/拉(例如{{1 }})。我创建了一个新的远程“heroku-app”并添加git push
以告诉remote = heroku-app
使用不包含URI中的heroku帐户的远程。
现在我可以按照自己的意愿运行heroku
和git
命令。
答案 3 :(得分:6)
我有同样的问题,我所要做的就是cd到项目目录,而不是从项目目录中的模型文件夹运行命令。
答案 4 :(得分:2)
这件疯狂的事对我有用:
如果您在本地计算机上有应用程序的git repo副本,那么cd
到该位置,那就是 !!
您将可以使用该应用。您可以通过以下命令对此进行验证:heroku logs -n 1500