2011-10-10 29 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

相关问题