Skip to content

Error cloning a Git repository on Heroku #34

look opened this Issue Jun 19, 2009 · 5 comments

5 participants

look commented Jun 19, 2009

Cool plugin. I got it working for a GitHub repository, but when I tried cloning one from Heroku I got the following error. Heroku says I'm fetching an invalid path.

When I use git to clone the repository with the same Git URL it works. Anyone get this working? I know this usage is probably kind of non-standard. ;)

hg gclone
fetching from : origin
importing Hg objects into Git
Invalid path.
Syntax is:<app>.git where <app> is your app's name
** unknown exception encountered, details follow
** report bug details to
** or
** Mercurial Distributed SCM (version 1.2.1)
** Extensions loaded: churn, fetch, bookmarks, hg-git, hgk
Traceback (most recent call last):
  File "/opt/local/bin/hg", line 27, in <module>
  File "/opt/local/lib/python2.5/site-packages/mercurial/", line 16, in run
  File "/opt/local/lib/python2.5/site-packages/mercurial/", line 25, in dispatch
    return _runcatch(u, args)
  File "/opt/local/lib/python2.5/site-packages/mercurial/", line 41, in _runcatch
    return _dispatch(ui, args)
  File "/opt/local/lib/python2.5/site-packages/mercurial/", line 372, in _dispatch
    return runcommand(lui, repo, cmd, fullargs, ui, options, d)
  File "/opt/local/lib/python2.5/site-packages/mercurial/", line 247, in runcommand
    ret = _runcommand(ui, options, cmd, d)
  File "/opt/local/lib/python2.5/site-packages/mercurial/", line 417, in _runcommand
    return checkargs()
  File "/opt/local/lib/python2.5/site-packages/mercurial/", line 377, in checkargs
    return cmdfunc()
  File "/opt/local/lib/python2.5/site-packages/mercurial/", line 371, in <lambda>
    d = lambda: util.checksignature(func)(ui, *args, **cmdoptions)
  File "/opt/local/lib/python2.5/site-packages/mercurial/", line 718, in check
    return func(*args, **kwargs)
  File "/Users/look/hg-git/", line 42, in gclone
  File "/Users/look/hg-git/", line 105, in fetch
    refs = self.fetch_pack(remote_name)
  File "/Users/look/hg-git/", line 557, in fetch_pack
    refs = client.fetch_pack(path, determine_wants, graphwalker, f.write, sys.stdout.write)
  File "/Users/look/hg-git/dulwich/", line 344, in fetch_pack
  File "/Users/look/hg-git/dulwich/", line 166, in fetch_pack
    (refs, server_capabilities) = self.read_refs()
  File "/Users/look/hg-git/dulwich/", line 112, in read_refs
    for pkt in self.proto.read_pkt_seq():
  File "/Users/look/hg-git/dulwich/", line 77, in read_pkt_seq
    pkt = self.read_pkt_line()
  File "/Users/look/hg-git/dulwich/", line 64, in read_pkt_line
    raise HangupException()

try git+ssh://

undees commented Jul 5, 2009

This alone won't work, because hg-git adds a leading slash to the repo name, and Heroku doesn't like that. One of these days, I'll make the path-parsing function generic enough to understand both Github-style and Heroku-style paths. In the meantime, since I only have to push to Heroku once every few weeks, I just qpush and qpop this patch in my hg-git repo for that one special case:

diff --git a/ b/
--- a/
+++ b/
@@ -838,6 +838,6 @@
                     host = 'git@' + host
                     host, path = uri[len(handler):].split("/", 1)
-                return transport(host), '/' + path
+                return transport(host), path
         # if its not git or git+ssh, try a local url..
         return SubprocessGitClient(), uri
look commented Apr 27, 2010

Using the current version I am able to push to Heroku using a URL like this:

hg push git+ssh://

Cloning works too.


The workaround proposed by 'look' stops working with Mercurial 2.0 (at least). hg-git adds a trailing slash to the repository path, which is not expected by Heroku.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.