Heroku: How to change a Git remote on Heroku Heroku: How to change a Git remote on Heroku git git

Heroku: How to change a Git remote on Heroku


If you're working on the heroku remote (default):

heroku git:remote -a [app name]

If you want to specify a different remote, use the -r argument:

heroku git:remote -a [app name] -r [remote] 

EDIT: thanks to Алексей Володько For pointing it out that there's no need to delete the old remote.


Assuming your current remote is named origin then:

Delete the current remote reference with

git remote rm origin

Add the new remote

git remote add origin <URL to new heroku app>

push to new domain

git push -u origin master

The -u will set this up as tracked.


  1. View Remote URLs

    > git remote -v

    heroku  https://git.heroku.com/###########.git (fetch) < your Heroku Remote URL    heroku  https://git.heroku.com/############.git (push)    origin  https://github.com/#######/#####.git (fetch) < if you use GitHub then this is your GitHub remote URL    origin  https://github.com/#######/#####.git (push)
  1. Remove Heroku remote URL

    > git remote rm heroku

  2. Set new Heroku URL

    > heroku git:remote -a ############

And you are done.