Deploying To Heroku using Git as a newbie

After preparing a simple node.js app, I deployed it to Heroku. by going through the following terminal commands (also see heroku guide)

git add .
git commit -msg "first commit"
heroku create stack --cedar
git push heroku master
heroku ps:scale web=1
heroku ps
heroku logs

Once deployed the app errored. So I rebulit and redeployed. When you do this several times in a short space of time it’s worth remembering the following…

Heroku locks on to a deployment environment using your git config. What I mean by this is when you do git commit and then git push heroku master, git is told about the url it is pushing to.

So when you do

git remote -v

This tells you what environments git has remote repositories stored at. I was mistakenly creating new cedar stacks and trying to deploy to them after destroying previous “erroring” stacks and kept getting a similar error to this: ! No such app as fierce-fog-63. What I should have done is kept the existing heroku stack (fierce-fog-63) and deployed to that instead.

So to remove the link between git and the remote repository and create a new link to a stack you have just created, you execute the following:

git remote rm heroku
git remote add heroku git@heroku.com:new-environment-123.git

where new-environment-123.herokuapp.com is the heroku url you are deploying to.

More info on this at http://stackoverflow.com/questions/2947190/pushing-app-to-heroku-problem

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s