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

你。 提交于 2019-12-06 04:22:21

问题


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.


回答1:


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




回答2:


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.



来源:https://stackoverflow.com/questions/10045169/how-to-link-a-folder-with-an-existing-heroku-app-with-mercurial

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!