You made a mistake pushing your code to the work account instead of your personal account!?!! The Horror! The Pain!! OMG... The PAIN!!!
Apparently you were on your PC and had logged into the work account the last time you made a push and now you have created a personal heroku app, most likely a weekend hobby project and yes, you pushed to the office dashboard... Hmmm. Well let's fix that shall we?
Here's how to fix that.
- Log in to your account on Heroku via the CLI
heroku login
Enter your credentials. Apparently this is why you pushed to the wrong account in the first place! Duh!
- Check the remote urls that your app is hosted on
// Check for the current url
git remote -v
- Well seeing as your current user account cannot push to the remote heroku url, we then have to delete it!
// remove remote url
git remote rm heroku
- Now we have to create a new Heroku app via the CLI since we are now logged into your user account
heroku create
- You get a url at this point, which is also created on your heroku dashboard. Now set this url as the remote url for your app
git remote add https://git.heroku.com/<unique-heroku-app-name>.git
- We can never be too careful! Just to be sure run
git remote -v
- Now we are confident to push our app to heroku
git push heroku master
Phew! That was a close call mate!
Top comments (0)