Error of clone mercurial hg - & ldquo; cancel: error: Unknown name or service & rdquo;


I have installed the latest hg package available for Fedora Linux. However, hg clone reports an error.

hg clone http://localmachine001:8000/ repository


"abort: error: Name or service not known"

localmachine001 is a computer within the local network. I can ping it from my Linux box without any problems. I can also use the same http address and browse the existing code. However, hg clone does not work.

If I execute the same command from my Macintosh machine, I can easily clone the repository.

Some Internet resources recommend editing .hgrc file, and adding proxy to it:


I have tried that without any success. Also, I assume that proxy is not needed in this case, since the hg server machine is in my local network.

Can anyone recommend me what should I do, or how could I track the problem?

Thank you in advance.

The problem is (likely) that your http proxy is not able to:

  1. Resolve localmachine
  2. Reach your (or localmachine's) local IP, even if it could resolve 'localmachine' to your correct local address.

First, make sure nothing on your side (iptables / NAT / firewall) is preventing egress or ingress on the proxy port. If it works if you're root, that's the problem - work backwards from there.

Its also conceivable that your proxy is mangling the responses from the remote HG sufficiently to confuse Mercurial, but not your browser. In either case, its best to just go around the proxy if the HG is on the local (localhost/lan) network.

Fortunately, the [http_proxy] directive supports bypassing the proxy for certain host names, which is ideal for dealing with stuff on the same side of a NAT, or hosts that only exist on one machine (e.g. resolved via /etc/hosts.) This saves the pain from having to edit .hgrc every time you need to change the behavior.

See the documentation, or simply make your .hgrc look something like this:


The operative directive of course being no. I'm not sure if you can use wildcards when specifying the hosts (I don't use the proxy feature, so no way of testing that .. and its not specified in the documentation). You might try experimenting with that, e.g. 192.168.1.* and let us know if that works as well.

Anyway, for the terminally lazy (or people in a rather big hurry), the related section of the documentation linked above:


Used to access web-based Mercurial repositories through a HTTP proxy.

    Host name and (optional) port of the proxy server, for example "myproxy:8000".
    Optional. Comma-separated list of host names that should bypass the proxy.
    Optional. Password to authenticate with at the proxy server.
    Optional. User name to authenticate with at the proxy server.