2011-10-10 56 views
16

我試圖創建2個不同的Heroku應用程序使用相同的代碼與同一個git存儲庫。 App1是由我的朋友在Heroku中創建的,我不是合作者,app2是我嘗試部署的同一個git存儲庫的分支。這可能嗎?使用相同的代碼和git存儲庫部署2個不同的heroku應用程序

我得到當我嘗試部署的第二個應用的Heroku的錯誤:

$ git push heroku branch1:master  
! [email protected] not authorized to access app1 
fatal: The remote end hung up unexpectedly 

回答

26

您將需要設置不同的git的遠端點在Heroku的每個應用程序,所以你可以推到從一個當地的回購申請。我不使用'heroku'這個名字作爲我的遠程(儘管它並不重要),我使用映射到不同的Heroku應用程序的生產和分段。所以,我可以這樣做:

git push production master 

git push staging staging:master 

通過git remote -v檢查遠程端點在項目根。它會顯示默認的heroku映射到您的應用程序。

獲取網址,通過儀表盤您在Heroku上的應用和做

git remote add production <gitrepo for production app here> 

git remote add staging <gitrepo for staging app here> 

不過,從您發佈的錯誤,它看起來像你不是在APP1應用的合作者。

+0

thanks @John!完成它:)'git remote -v'然後'git remote add staging '訣竅:) – Sayanee

+0

仍然沒有回答多個應用程序的問題。我想你需要圍繞多個.Profiles來部署不同的應用程序。 – Patricio

相關問題