Heroku: How do you push to specific app if you have multiple apps in heroku?
Asked Answered
S

2

10

I create a new heroku app using heroku create test-app3. Now if I want to push some code to this new test-app3, how do I do that?

When I type heroku list in the terminal I get: My Apps

  • test-app1
  • test-app2
  • test-app3

How do I push to test-app3? How do I switch between which app to push to?

Swarts answered 28/9, 2015 at 3:57 Comment(0)
K
24

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.

Get the GIT URLs for your apps on Heroku via the dashboard (it will look something similar to this: https://[email protected]:your_app_name.git) and do:

git remote add test-app1 https://[email protected]:test-app1.git

git remote add test-app2 https://[email protected]:test-app2.git

git remote add test-app3 https://[email protected]:test-app3.git

Then you will be able to push to any specific app like this:

git push test-app1 master

git push test-app2 master

git push test-app3 master
Kite answered 28/9, 2015 at 4:10 Comment(6)
I was getting fatal: Not a git repository so I typed git init but now if I type git remote add test-app1 I get usage: git remote add [<options>] <name> <url>. What should I do?Swarts
whats the output of your: git remote -v?Kite
did you do this? git remote add test-app1 <gitrepo for test-app1 here>? then should be able to see something when you do: git remote -vKite
gitrepo, I didn't do that. I don't have github so where do I get the gitrepo?Swarts
Let us continue this discussion in chat.Kite
You need the https:// before the git URL, so the correct URL is https://[email protected]:test-app3.git. I updated the post to reflect this.Thermogenesis
N
0

You navigate your app from terminal with cd test-app3, then:

git add .
git commit -m "your message"
git push

and finally:

git push heroku master or git push heroku main, depending on the name of your main branch.

Nodose answered 6/5, 2022 at 17:21 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.