Heroku App Rename From Web Stops your Git Commit From Working

I recently discovered Heroku. And it's easy to make a mess ..err.. mistake when you are new. I recently created a new app on Heroku and renamed it from the web interface on a whim. Suddenly my Git command-line failed complaining my app did not exist - oops! Did you do that too? Here's a way out of the mess.

So why did this happen?
Changing the app name also changed the Git URL. Particularly the remote. What was first:

git@heroku.com:my-original-name.git

now becomes:

git@heroku.com:my-new-name.git

Particularly painful when you have outstanding changes pending a commit.


Understood, how do I sort this?
Luckily that's the easy part - as soon as you know how ;-) Execute the following two commands:

$git remote rm heroku
$heroku git:remote -a my-new-name

And now try your Git commit - Phew!

Lesson learnt?
Stick to either command-line or GUI - especially when you are new to things. Saves a lot of time :)

And for completeness, here's how you rename your heroku app from the command line.

Have fun playing with Heroku!