58

を使用して簡単なRailsアプリを作成しました

rails new myapp

次に、以下を使用してherokuスタックを作成しました。

heroku create --stack cedar 

しかし、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

明らかな何かが欠けていますか?

4

5 に答える 5

130

Heroku に既存のアプリがあり、このアプリが指定されていないというメッセージが表示される場合は、ローカル ターミナルでこれを実行して修正できます。

heroku git:remote -a MyHerokuAppName

于 2014-07-18T02:18:55.737 に答える
26

デフォルトでは、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
于 2012-09-18T15:31:57.520 に答える
20

この問題を解決するもう 1 つの方法は、heroku アプリに関連付けられている .git/config ファイルが何を行っているかを広く理解し、必要な調整を行うことです。

1.heroku.git/configプロジェクトのルートから開きます。

マシン上でいくつかの heroku アカウントを使いこなしている場合は特に、git 構成ファイルは次のようになります。

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これを解決する 1 つの方法は、remote forとherokuremote for を定義して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リモートはそのためのものですが、この構成はデフォルト (例: ) を使用したプッシュ/プルにも対応していますgit push。新しいリモート 'heroku-app' を作成し、URI に heroku アカウントを含まないリモートを使用するremote = heroku-appように指示するように追加します。heroku

gitこれで、必要に応じてコマンドとコマンドを実行できますheroku

于 2013-02-15T17:34:47.350 に答える
2

このクレイジーなことは私のために働いた:

ローカル マシンにアプリの git リポジトリ コピーがある場合は、そのcd場所に移動します。

アプリが使えるようになります。これは、次のようなコマンドで確認できます。heroku logs -n 1500

于 2017-09-30T14:26:25.037 に答える