Un altro approccio al solv il problema è di comprendere a fondo il funzionamento del file .git/config associato all'app heroku e apportare le modifiche necessarie.
1.Open .git/config
dalla radice del progetto heroku.
Il tuo file di configurazione git potrebbe essere simile a questo, specialmente se stai manipolando un paio di account heroku sulla tua macchina.
[email protected]{heroku.account}
si presenta invece di [email protected]
a causa della configurazione nel file ~/.ssh/config
. Il riferimento a heroku-app-8396.git
deve essere aggiornato per corrispondere al nome del tuo progetto heroku. Ogni account heroku di cui si dispone deve avere una voce nel file ~/.ssh/config
. Ovviamente, l'account heroku a cui è associato questo progetto heroku dovrebbe apparire nel tuo file .git/config
.
[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. Quando corro git pull heroku master
, tutto sembra funzionare bene.
3.Quando corro heroku logs
, ottengo un messaggio di errore:
$ heroku ps
! No app specified.
! Run this command from an app folder or specify which app to use with --app APP.
Perché?
Per quanto posso dire, il comando heroku
non sembra sapere cosa fare con i riferimenti {heroku.account}
.Se cambiamo quei riferimenti a com
(che è il valore predefinito quando non si utilizza il plugin Heroku 'conti'), i comandi heroku
lavorare ancora una volta, ma ora i nostri git
chiamate stai dicendo che c'è un problema diverso:
$ 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.
Un modo per risolvere questo è definire un telecomando per git
e un telecomando per heroku
e quindi dirlo a heroku
quale telecomando da utilizzare.
[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
mi piace per specificare esplicitamente il telecomando quando sto spingendo contenuti a un remoto, in modo il telecomando heroku
è per questo, anche se questa configurazione anche ospita fino a spingere/tirare utilizzando il default (ad esempio, git push
). Creo un nuovo 'heroku-app' remoto e aggiungo remote = heroku-app
per comunicare a heroku
di utilizzare un telecomando che non include l'account heroku nell'URI.
Ora posso eseguire i miei comandi git
e heroku
come desidero.
Non è più necessario specificare lo stack di cedro, è il valore predefinito ora –
Assicurarsi di scorrere verso il basso oltre le prime due risposte. [Questo] (http://stackoverflow.com/a/24816347/199712) è il migliore. –