Heroku: Moving existing repository to a new location

Faced this a few times now that I am on a new laptop…moving an existing repository and app to a new location. It’s really a two step process:

  1. Pull the existing Git repo into the new location:

    git clone git@heroku.com:.git 
    
  2. Change the Heroku configuration on the existing repo (not sure if I explained that quite right):

    cd 
    git remote rm heroku (this may fail, no worries)
    git remote add heroku git@heroku.com:.git
    

You can also use

git remote -v

to understand what is being pushed where.

Advertisements