Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deploying 2 different heroku apps with same code and git repository

I'm trying to create 2 different Heroku apps using the same code with the same git repository. App1 is created in Heroku by my friend and i'm not a collaborator and app2 is the branch of the same git repository that i'm trying to deploy. Is this possible?

I'm getting an error when i'm trying to deploy the 2nd app to Heroku:

$ git push heroku branch1:master    
!  [email protected] not authorized to access app1
fatal: The remote end hung up unexpectedly
like image 979
Sayanee Avatar asked Oct 10 '11 12:10

Sayanee


2 Answers

You will need to setup different git remote end points for each application at Heroku so you can push to either application from the one local repo. I don't use the 'heroku' name as my remote though (not that it really matters) I use production and staging mapped to different Heroku applications. So I can do:

git push production master

or

git push staging staging:master

Check your remote endpoints via git remote -v in the projects root. It will show the default heroku mapped to your application.

Get the URLs for your apps on Heroku via the dashboard and do

git remote add production <gitrepo for production app here>

git remote add staging <gitrepo for staging app here>

However, from the the error you've posted it looks like you're not a collaborator on the app1 application.

like image 111
John Beynon Avatar answered Sep 17 '22 12:09

John Beynon


There is a really good guide out there in the Heroku Dev Center: https://devcenter.heroku.com/articles/multiple-environments

like image 26
KrauseFx Avatar answered Sep 18 '22 12:09

KrauseFx