views:

388

answers:

2

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

hg clone http://localmachine001:8000/ repository

reports:

"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:

[http_proxy]
host=proxy:8080

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.

+1  A: 

Clone and the web interface use exactly the same mechanism, so it's very odd that you can see the repo at http://localmachine001:8000/ but you can't clone from it.

What about trying to go to that machine by IP address? Something like hg clone http://192.168.0.4:8080 and see what happens?

Any more detail with --debug?

Ry4an
knowing if `ping localmachine001` works could help too.
tonfa
I have tried hg clone http://ipaddress:8000 but it does not work either.
Bojan Milankovic
@tonfa - I can ping localmachine, I said it in the question.
Bojan Milankovic
Please try the --debug. Also make sure the proxy stuff was removed from your .hgrc. It's not just something you don't need, but something that will prevent the clone from working.
Ry4an
Thanks for all the help, Ry4an.
Bojan Milankovic
+1  A: 

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.

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:

[http_proxy]
host=proxy:8080
no=localmachine,192.168.1.123,192.168.1.234,...,...

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:

http_proxy

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

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