简体   繁体   English

Mercurial hg clone错误 - “abort:error:名称或服务未知”

[英]Mercurial hg clone error - “abort: error: Name or service not known”

I have installed the latest hg package available for Fedora Linux. 我已经为Fedora Linux安装了最新的hg软件包。 However, hg clone reports an error. 但是,hg clone报告错误。

hg clone http://localmachine001:8000/ repository

reports: 报告:

"abort: error: Name or service not known"

localmachine001 is a computer within the local network. localmachine001是本地网络中的计算机。 I can ping it from my Linux box without any problems. 我可以毫无问题地从我的Linux机器上ping它。 I can also use the same http address and browse the existing code. 我也可以使用相同的http地址并浏览现有代码。 However, hg clone does not work. 但是,hg clone不起作用。

If I execute the same command from my Macintosh machine, I can easily clone the repository. 如果我从Macintosh机器执行相同的命令,我可以轻松克隆存储库。

Some Internet resources recommend editing .hgrc file, and adding proxy to it: 某些Internet资源建议编辑.hgrc文件,并向其添加代理:

[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. 此外,我假设在这种情况下不需要代理,因为hg服务器机器在我的本地网络中。

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: 问题是(可能)您的http代理无法:

  1. Resolve localmachine 解决localmachine
  2. Reach your (or localmachine 's) local IP, even if it could resolve 'localmachine' to your correct local address. 到达你的(或localmachine的)本地IP,即使它能够解决‘LOCALMACHINE’你正确的本地地址。

First, make sure nothing on your side (iptables / NAT / firewall) is preventing egress or ingress on the proxy port. 首先,确保您身边没有任何东西(iptables / NAT /防火墙)阻止代理端口上的出口或入口。 If it works if you're root, that's the problem - work backwards from there. 如果它是root用户,那就是问题 - 从那里向后工作。

Its also conceivable that your proxy is mangling the responses from the remote HG sufficiently to confuse Mercurial, but not your browser. 也可以想象你的代理正在破坏来自远程HG的响应,足以混淆Mercurial,而不是你的浏览器。 In either case, its best to just go around the proxy if the HG is on the local (localhost/lan) network. 在任何一种情况下,如果HG位于本地(localhost / lan)网络上,最好只是绕过代理。

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 (eg resolved via /etc/hosts.) This saves the pain from having to edit .hgrc every time you need to change the behavior. 幸运的是, [http_proxy]指令支持绕过某些主机名的代理,这非常适合处理NAT同一端的内容,或者只存在于一台机器上的主机(例如通过/ etc / hosts解析)。每次需要更改行为时,都不必编辑.hgrc

See the documentation , or simply make your .hgrc look something like this: 请参阅文档 ,或者只是让.hgrc看起来像这样:

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

The operative directive of course being no . 手术指令当然是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, eg 192.168.1.* and let us know if that works as well. 您可以尝试使用它,例如192.168.1.*并告诉我们是否也可以。

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.

Running hg as root solved the problem for me. 以root身份运行hg解决了我的问题。 But still don't know why. 但还是不知道为什么。

This happened to me when my DNS name server settings weren't configured. 当我的DNS名称服务器设置未配置时,这发生在我身上。 Try to ping the remote repository host and try to ping some well-known host eg google.com . 尝试ping远程存储库主机并尝试ping一些知名主机,例如google.com If it doesn't work, fix your DNS settings. 如果它不起作用,请修复DNS设置。

The error is because of DNS, add entry into /etc/resolve.conf . 该错误是因为DNS,将条目添加到/etc/resolve.conf

$ cat /etc/resolve.conf
search xyz.com abc.com   --> DOMAINS
nameserver 10.192.160.12 -->DNS1
nameserver 10.193.180.23 -->DNS2

This enables to reach local machine by name, & hence clone will be successful. 这样可以按名称访问本地计算机,因此克隆将成功。

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. 克隆和Web界面使用完全相同的机制,因此很奇怪您可以在http:// localmachine001:8000 /上看到repo,但您无法从中进行克隆。

What about trying to go to that machine by IP address? 怎么样试着通过IP地址去那台机器? Something like hg clone http://192.168.0.4:8080 and see what happens? hg clone http://192.168.0.4:8080类的东西,看看会发生什么?

Any more detail with --debug ? --debug还有更多细节吗?

I Faced same issue, 我遇到同样的问题,

To resolve this issue i just disconnected my internet from my laptop and reconnected again 要解决此问题,我只是将我的互联网与笔记本电脑断开连接并再次重新连接

Thankyou Happy coding ;) 谢谢你快乐的编码;)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM