bitbucktからpullする時のwarning

bitbucket.orgにあるレポジトリからpullしようとすると
やたら

warning: bitbucket.org certificate with fingerprint ~~~ not verified (check hostfingerprints or web.cacerts config setting)

と言ってくるときの対処法。(Mac)

認証局CAの設定

Keychain Access.appを開き、[keychains] > [System Roots] + [Category] > [Certificates]を選択。
右のペインのリストをすべて選択して[File] >[Exports Items]を選択し、"Certificates.pem"の様な名前で適当な場所に保存する。

保存したら"/etc/"以下にコピー。

% sudo cp ~/Desktop/Certificates.pem /etc/hg-ca-roots.pem

.hgrcの編集

.hgrcに以下を追加

[web]
cacerts = /etc/hg-ca-roots.pem

確認

% hg pull
http authorization required
realm: Bitbucket.org HTTP
user: USER
password: 
pulling from https://repo_url/
searching for changes
no changes found
% ok :-)