, LLC.

Git Remotes for an Existing Heroku  App

Quickly add a git remote for an existing Heroku app.

I find myself doing this all the time, so I wanted to make note of the snippet here for anyone else commonly looking to add a Git remote for an existing Heroku app using the Heroku CLI. Open up your Terminal and enter the following commands to quickly link an existing Git project with one of your Heroku app’s.

Find Your Heroku Project Name

heroku list

This is display a list of all the Heroku projects you currently have, make sure you see the app name that you want to link with your git repo here.

Add The Git Remote

heroku git:remote -a PROJECT_NAME -r heroku

The -a parameter defines the name of your project, e.g. PROJECT_NAME, and the -r parameter defines the name of the git remote you want to use. The default value for the -r parameter is heroku.

That’s it! You can now push to heroku using the newly added remote.

Meet the Author

Kevin Leary, WordPress Consultant

I'm a freelance web developer and WordPress consultant in Boston, MA with 16 years of experience building websites and applications. View a portfolio of my work or request an estimate for your next project.