Search code examples
djangodeploymentmercurialherokuhg-git

How to link a folder with an existing Heroku app with mercurial


I have an existing Django app on Bitbucket and I'm able to deploy to Heroku whith hg-git. Whenever i want to run some heroku command inside my app folder i get the following errors:

$ heroku ps
 !    No app specified.
 !    Run this command from an app folder or specify which app to use with --app <app name>
$ heroku logs
 !    No app specified.
 !    Run this command from an app folder or specify which app to use with --app <app name>
etc.

Current workaround is to specify the app name: heroku ps --app <app name> but i'm looking for a way to link my repository name to the remote Heroku app name like how it's done using git.

I'm not in a position to move my app to github for now.


Solution

  • Considering heroku is looking at the .git/config file to get the app name, just do the following inside your local repository:

    git init
    git remote add heroku git@heroku.com:<app-name>.git
    

    In order not to mess your repository, you'll also add the following lines to .hgignore:

    #Git setup
    .git/**
    

    Now, usual heroku commands no more ask for the default app name.