Creating an App in heroku

I had recently created a heroku app. The syntax for creating a heroku app is

heroku create [app-name]

If you don’t provide an app name, heroku will generate one for you. It will be something like ‘stormy-hamlet-9918’. I’m neither a git or heroku expert. But, I think what happens when you issue this command is that it creates a remote with the name (taking from the example) stormy-hamlet-9918.git. The url to your app will be stormy-hamlet-9918.herokuapp.com

Now you can push to heroku using command

git push heroku master

Renaming the App.

Heroku gives provision to rename the app to something that you understand. Log into your heroku.com account. Change the name of your app from Settings tab. Say you changed the name to ‘MyNewApp’. The url to your app will also be updated. It will be MyNewApp.herokuapp.com. stormy-hamlet-9918.herokuapp.com will no longer work.

Pushing new changes to Heroku.
Now that we have changed the name of the app, pushing new changes will require a little clean up work.

git push heroku master

will give you error like this.

 !  No such app as stormy-hamlet-9918.
fatal: The remote end hung up unexpectedly

This is because when we renamed the app to MyNewApp the remote repository name stormy-hamlet-9918.git no longer exists. Its MyNewApp.git now. Here are the steps to fix the issue.

git remote rm heroku
git remote add heroku git@heroku.com:MyNewApp.git

Once this step is done, git push heroku master will work.

DISCLAIMER: I’m new to heroku, git and all. So, if there’s anything wrong that I have mentioned here, please be kind enough to correct me. Thanks.

Leave a Reply

Your email address will not be published. Required fields are marked *

Post Navigation