How to link a folder with an existing Heroku app w

2019-04-10 11:33发布

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.

2条回答
该账号已被封号
2楼-- · 2019-04-10 11:47

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.

查看更多
你好瞎i
3楼-- · 2019-04-10 11:50

I'd suggest trying Hg-Git's "intree" configuration option. Set that by adding the following to your hgrc:

[git]
intree = True

With that set, the Git repository used internally by Hg-Git will be stored as a ".git" directory within the working copy, rather than nested within the ".hg" directory.

Heroku will then see this repository's config. Add a remote as suggested in the other answer (quoted below), and you should be all set.

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

For now, the best documentation of Hg-Git configuration options that I've found is the README displayed on the project's Bitbucket page: https://bitbucket.org/durin42/hg-git

查看更多
登录 后发表回答