3

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.

oceanician
  • 399
  • 4
  • 14
  • 1
    ahh, then this appears in related: http://stackoverflow.com/questions/5129598/how-to-link-a-folder-with-an-existing-heroku-app – oceanician Mar 25 '14 at 12:32

4 Answers4

3

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 git@heroku.com: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 :)

rdegges
  • 32,786
  • 20
  • 85
  • 109
3

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

Rohit Sureka
  • 191
  • 1
  • 5
2

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

sparkyspider
  • 13,195
  • 10
  • 89
  • 133
1

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.

danielsmith1789
  • 1,056
  • 1
  • 12
  • 25