I have an existing Rails app on GitHub and deployed on Heroku. I’m trying to set up a new development machine and have cloned the project from my GitHub repository. However, I’m confused as to how to link this folder up to Heroku. Originally, I used the heroku create command, but obviously I don’t want to do that this time since it will create another Heroku instance.
I have an existing Rails app on GitHub and deployed on Heroku. I’m trying
Share
Heroku links your projects based on the
herokugit remote (and a few other options, see the update below). To add your Heroku remote as a remote in your current repository, use the following command:where
projectis the name of your Heroku project (the same as theproject.heroku.comsubdomain). Once you’ve done so, you can use theheroku xxxxcommands (assuming you have the Heroku Toolbelt installed), and can push to Heroku as usual viagit push heroku master. As a shortcut, if you’re using the command line tool, you can type:where, again,
projectis the name of your Heroku project (thanks, Colonel Panic). You can name the Git remote anything you want by passing-r remote_name.[Update]
As mentioned by Ben in the comments, the remote doesn’t need to be named
herokufor the gem commands to work. I checked the source, and it appears it works like this:--appoption (e.g.heroku info --app myapp), it will use that app.--remoteoption (e.g.heroku info --remote production), it will use the app associated with that Git remote.heroku.remoteset in your Git config file, it will use the app associated with that remote (for example, to set the default remote to “production” usegit config heroku.remote productionin your repository, and Heroku will rungit config heroku.remoteto read the value of this setting).git/configfile, and the gem only finds one remote in your Git remotes that has “heroku.com” in the URL, it will use that remote.--appto your command.