Tuesday, April 04, 2017

Heroku: Deploying with GIT



In this post I will explain how to deploy to Heroku directly through GIT. In order to see what git tree your Heroku repo is using, try:

$ git ls-remote git@heroku.com:APP-NAME.git

To find out the Heroku git repository name, you can also try

$ heroku info --app APP-NAME
=== app-name
Addons:
Auto Cert Mgmt:
Collaborators:
Dynos:
Git URL:
...

Right now, you know the Heroku git repository name, but you don't have a remote branch to push to.
Your Heroku app starts with a blank repository, it has no branches and no code. So the first time you deploy, you’ll need to specify a remote branch to push to.

For instance, imagine you have a server for Production where you deploy the APP-NAME, so you can create the remote called "pro-heroku".


$ git remote add pro-heroku https://git.heroku.com/APP-NAME.git

And now, if you have the git branch called "production" and we need to deploy this branch to Production, then you can try:

$ git push pro-heroku production:master

This will push your local branch production to the remote branch master in pro-heroku so APP-NAME will get deployed with the code in production branch.


I hope this post helps, if you have any comment or something please don't hesitate to add your comments.

No comments:

Post a Comment