oceanician
oceanician

Reputation: 399

Setting up an existing Heroku application on a new machine

I've an existing project that works fine on another machine, but I've just upgraded and from within the project development directory, everytime I run a heroku command I have to post-fix it with --app

I feel like I've missed an application setup stage, but I can't figure out what, as everytime it states: Run this command from an app folder or specify which app to use with --app APP.

Help appreciated.

Upvotes: 3

Views: 3013

Answers (4)

danielsmith1789
danielsmith1789

Reputation: 672

Run this command from an app folder or specify which app to use with --app APP

The other answers address the first part of that statement, it is perfectly acceptable to run heroku commands in any directory. For example I have a customer facing front end project /front-end and a rails based /back-end project. I often work in the /front-end directory and if I have to connect to the production database I'll run heroku run rails c -a back-end. After I exit irb then I'm back in my desired directory.

Upvotes: 1

Rohit Sureka
Rohit Sureka

Reputation: 341

In other words, your local repo doesn't have Heroku app URL configured against an app name

Similarly what we do with git remote add ( we pass git URL as a destination for push/pulling of code ) that how our git know which repo/URL to hit (push/pull from )

Heroku also follows the same method/process. All you have to do is add Heroku app URL (so that ur Heroku command have a reference for app URL )

it will know against which URL you are running your command against

To confirm if remote named Heroku has been set for your app: git remote -v

if not configured or if you want it for an existing app

heroku git:remote -a app_name

it's a way to link your folder to the Heroku app

Upvotes: 4

sparkyspider
sparkyspider

Reputation: 13519

The Heroku recommended way:

heroku git:remote -a my-heroku-app-id -r what-i-want-to-call-it

Source: https://devcenter.heroku.com/articles/git

Upvotes: 2

rdegges
rdegges

Reputation: 33824

You can solve this by adding the Heroku app to your .git/config folder.

If you are in the root of your project, run the following command:

git remote add heroku [email protected]:appname.git

This will set a line in your .git/config file which the heroku command line tool uses to figure out what app you're using :)

Upvotes: 3

Related Questions