Sno*_*ash 55 ruby-on-rails heroku
我刚刚创建了一个简单的Rails应用程序
rails new myapp
Run Code Online (Sandbox Code Playgroud)
然后使用以下方法创建了heroku堆栈:
heroku create --stack cedar
Run Code Online (Sandbox Code Playgroud)
但是当我尝试在Heroku上打开应用程序时:
heroku open
Run Code Online (Sandbox Code Playgroud)
我明白了:
! No app specified.
! Run this command from an app folder or specify which app to use with --app <app name>
Run Code Online (Sandbox Code Playgroud)
还有这个:
$ heroku open --app myapp
Run Code Online (Sandbox Code Playgroud)
给我这个:
! App not found
Run Code Online (Sandbox Code Playgroud)
我错过了一些明显的东西吗
Aar*_*ray 126
如果您在Heroku上有一个现有应用程序并且您没有收到应用程序指定的消息,则可以通过在本地终端上运行此消息进行更正:
heroku git:remote -a MyHerokuAppName
小智 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
Run Code Online (Sandbox Code Playgroud)
它正在创建名为'calm-bayou-3229'的应用程序,你可以这样做
heroku open --app calm-bayou-3229
Opening http://calm-bayou-3229.herokuapp.com/
Run Code Online (Sandbox Code Playgroud)
您可以随时列出您的应用:
heroku apps
Run Code Online (Sandbox Code Playgroud)
Dav*_*ani 19
解决该问题的另一种方法是广泛了解与heroku应用程序关联的.git/config文件正在做什么,并进行必要的调整.
1. .git/config从你的heroku项目的根开始.
您的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
Run Code Online (Sandbox Code Playgroud)
当我跑步时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.
Run Code Online (Sandbox Code Playgroud)
为什么?
据我所知,该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.
Run Code Online (Sandbox Code Playgroud)
解决此问题的一种方法是定义远程for git和远程for 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
Run Code Online (Sandbox Code Playgroud)
我喜欢在将内容推送到遥控器时明确指定遥控器,因此heroku遥控器就是这样,即使这种配置也适应使用默认的推/拉(例如git push).我创建了一个新的远程"heroku-app"并添加remote = heroku-app告诉heroku使用URI中不包含heroku帐户的远程.
现在我可以运行我git和heroku命令,我想.