Book Image

Heroku Cookbook

By : Mike Coutermarsh
Book Image

Heroku Cookbook

By: Mike Coutermarsh

Overview of this book

Heroku is a Platform as a Service that enables developers to rapidly deploy and scale their web applications. Heroku is designed for developer happiness, freeing developers from doing system administrative tasks such as configuring servers and setting up load balancers. Developers are able to focus on what they do best, building web applications, while leaving the details of deployment and scaling to the experts at Heroku. This practical guide is packed with step-by-step solutions to problems faced by every production-level web application hosted on Heroku. You'll quickly get comfortable with managing your Heroku applications from the command line and then learn everything you need to know to deploy and administer production-level web applications.
Table of Contents (17 chapters)
Heroku Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Managing git remotes


Once we have multiple environments on Heroku for our application, we will need to learn how to push the same application code up to each different environment. This can be easily accomplished by adding additional git remotes on our machine. A Git remote is the location where Git pushes code to from our local machine. We can set up as many remotes as we like. It's common to have remotes for production, staging, and origin (most likely, GitHub or BitBucket).

When we push code to Heroku, the command typically looks like this:

$ git push heroku master

The name of the git remote that we're pushing to is heroku. We can change the name and destination of our remotes to anything we want. By default, Heroku sets up a remote named "heroku" for our application. In this recipe, you will learn how to add additional remotes so that you can push the same code to multiple Heroku applications.

How to do it...

First, we'll want to see what our current git remotes are. So, let's open a terminal...