この問題を解決するもう 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。