首页 > 解决方案 > 如何摆脱这个 Mercurial 警告?(主机安全/主机指纹)

问题描述

由于我使用 Mercurial 4.5.3 迁移到 Ubuntu 18.04,我看到以下警告:

(SHA-1 fingerprint for bitbucket.org found in legacy [hostfingerprints] section; if you trust this fingerprint, remove the old SHA-1 fingerprint from [hostfingerprints] and add the following entry to the new [hostsecurity] section: bitbucket.org:fingerprints=sha256:32:12:90:9a:70:64:82:1c:5b:52:cc:c3:0a:d0:79:db:e1:a8:62:1b:9a:9a:4c:f4:72:40:1c:a7:3a:d3:0a:8c)

现在我理解并欣赏这个警告。但是,我想让它保持沉默。最好通过添加相应的部分和条目.hgrc

[hostsecurity]
bitbucket.org:fingerprints=sha256:32:12:90:9a:70:64:82:1c:5b:52:cc:c3:0a:d0:79:db:e1:a8:62:1b:9a:9a:4c:f4:72:40:1c:a7:3a:d3:0a:8c

但无论我是否将新[hostsecurity]部分放在旧部分之前[hostfingerprints],警告都会继续显示。因此,我正在寻找一种使其静音的方法,最好仅针对该主机名和 inside .hgrc

与总是可以只使用最新发行版的一些快乐的人不同,我仍然运行着一些相当旧的发行版和 Mercurial。所以旧条目是必需的,尤其是在那些旧的 Mercurial 版本上。

标签: mercurial

解决方案


首先删除(注释掉)该hostfingerprints部分:

# [hostfingerprints]
# bitbucket.org = ..:..:...

然后添加新的主机安全部分:

hostsecurity]
bitbucket.org = sha256:..:..:... (with whatever the error message suggests)

看来您不能bitbucket.org:fingerprints=...像警告所建议的那样使用该节。


推荐阅读