I've been using Mercurial for quite some time and I'd like to start using Heroku as a deployment platform. However, they seem to support Git only. Does anybody knows how to Heroku using Mercurial?
Asked
Active
Viewed 4,289 times
27
-
4Well, you could use `hg-git`, but the real answer is "you don't". – Amber Mar 06 '12 at 20:35
-
4[This post](http://www.fantomfactory.org/articles/using-mercurial-and-git-in-harmony) from 2014-05 describes how to work in Mercurial while using Git only for pushing to Heroku. – Basil Bourque Sep 24 '14 at 05:49
3 Answers
26
Once you have installed the Hg-Git mercurial plugin, add an alias to the .hg/hgrc
of your repository:
[alias]
push-heroku = push git+ssh://git@heroku.com:<app name>.git
You are now able to push your application to Heroku:
hg push-heroku
Be aware that Heroku does not link your repository name with the remote Heroku app name by default.
-
1When I do that, it tries to push to `git+ssh://git@heroku.com:
.git/` (note that trailing slash). I *think* that's the reason I get the following: ! Invalid path. ! Syntax is: git@heroku.com: – Hank Gay Jun 17 '12 at 20:41.git where is your app's name. -
4You're hit by [this bug](https://github.com/schacon/hg-git/issues/226) so you need to install a recent version of hg-git from the github repo because you need this [commit](https://github.com/schacon/hg-git/commit/ed4cbf893ca9287ce6a82b970dbea08565f3dbc9). – Maxime R. Jun 17 '12 at 23:43
-
I'm hit by the trailing slash bug and neither the latest versions of `https://github.com/schacon/hg-git` nor `https://bitbucket.org/durin42/hg-git` work. I'm Win7 64bit with 64bit TortoiseHg 2.9.2. Does anyone know of a definitive hg-giti version that solves this issue? – Steve Eynon Oct 30 '13 at 20:34
-
2
You can use the Hg-Git Mercurial Plugin

Manfred Moser
- 29,539
- 13
- 92
- 123
-
Thank you Manfred. Even with the Hg-Git mercurial plugin (the one included with TortoiseHg), I can't get my project to deploy. – Martin Mar 09 '12 at 14:11
-
1hm.. but then you have a normal git repo .. it should work. What is the problem? – Manfred Moser Mar 10 '12 at 19:29
1
Use hg-git and add this to the repository's .hg/hgrc file under [paths]:
heroku = https://git.heroku.com/<app-name>.git
Now you can deploy by typing:
hg push heroku
It will prompt for username and password. These were stored in your ~/.netrc file when you ran heroku login (don't try to use your heroku account password, it won't work). Copy and paste from there. See: https://devcenter.heroku.com/articles/git#http-git-authentication for more information about authentication.

krupan
- 3,920
- 5
- 27
- 24
-
1This is some obscure knowledge that actually helps solve the OP's problem. Thanks, @krupan! I can successfully deploy my project to Heroku from a Mercurial repository by using hg-git and getting username+password from ~/.netrc. – Alexander Sukhoverkhov Sep 25 '21 at 15:24