I like Heroku. It’s straightforward and free and offers a great service. That being said, I did have some difficulties using Heroku after graduating from Flatiron. Then again, I also had some difficulty setting up a new environment on my Windows computer in contrast to the Mac computer I used in the bootcamp. Setting up my Github ssh also wasn’t the smoothest.
My point is that setting up software and using different services on your own greatly differs from having people immediately around you to help. However, you learn more because you’ll typically encounter more bugs and even go down different rabbit holes. I can also say that anything’s “first time” is typically much harder than the second, simply because now you know.
Today, I want to talk about changing the push and pull address that you have on your local repo. This is important because if you ever want to change the domain name of your application on the Heroku dashboard, the address also changes.
First, let’s check out where our current app pushes and pulls from!
// type in
git remote -v
And then I get back…
heroku https://git.heroku.com/sample-example-portfolio.git (fetch)
heroku https://git.heroku.com/sample-example-portfolio.git (push)
origin git@github.com:alinan-vn/sample-example-portfolio.git (fetch)
origin git@github.com:alinan-vn/sample-example-portfolio.git (push)
Interesting! Here we see that I’m pushing and pulling from my github and my heroku repos. So now we want to change the first two, to our new repo!
Looking at our Heroku settings we see…

As we see here our app name and our git url match our current addresses.
Now let’s change our app name to…

As we can see, the app name changes and so has our git url. But if we run “git remote -v” again nothing has changed!
We need to remove our old repo and add in the current url.
// removes our Heroku address
git remote rm heroku
// let's check out what we have now
git remote -v
And we see…
origin git@github.com:alinan-vn/sample-example-portfolio.git (fetch)
origin git@github.com:alinan-vn/sample-example-portfolio.git (push)
Good! We just wanted to remove our Heroku address and leave our github untouched. Now we need to update our address…
heroku git:remote -a just-sample
Notice that we aren’t inputting our whole git url! Just the app name! Our Heroku git url is automatically included just based on the app name. Let’s see what we get from running “git remote -v”
heroku https://git.heroku.com/just-sample-portfolio.git (fetch)
heroku https://git.heroku.com/just-sample-portfolio.git (push)
origin git@github.com:alinan-vn/sample-example-portfolio.git (fetch)
origin git@github.com:alinan-vn/sample-example-portfolio.git (push)
Perfect! Now when you “git push heroku master” it will push to the correct and current heroku git address and properly update your live website.
Just remember to now go your new URL link, otherwise you’ll encounter an empty space where the old URL is.