Conflict gpg-agent

Conflict gpg-agent

GitHubにGPG認証を利用しています。

さっきbrew upgradeをしていて、たぶんgpg関連のアップデートがあって恐らくそれがきっかけと思うんですが、git commitができなくなりました。

調査のためgpgコマンドをいじっていたら以下のエラーが出ました。

gpg: starting migration from earlier GnuPG versions
gpg: *警告*: サーバ'gpg-agent'はこちらより古いです(2.0.30 < 2.1.20)
gpg: error: GnuPG agent version "2.0.30" is too old.
gpg: Please make sure that a recent gpg-agent is running.
gpg: (restarting the user session may achieve this.)
gpg: migration aborted
...

gpg-agentのバージョンは2.1.20になっています。

$ gpg-agent --version
gpg-agent (GnuPG) 2.1.20
libgcrypt 1.7.6
Copyright (C) 2017 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

brewへのリンクも貼ってある。

$ ls -l `which gpg-agent`
lrwxr-xr-x  1 licorice  admin  36  4 22 12:23 /usr/local/bin/gpg-agent@ -> ../Cellar/gnupg/2.1.20/bin/gpg-agent

うーん。起動しているgpg-agentを見てみます。

$ pgrep -fl gpg-agent
458 /bin/bash /usr/local/MacGPG2/libexec/shutdown-gpg-agent
598 /usr/local/MacGPG2/bin/gpg-agent --daemon

ん?なんかpathが違う。

バージョンを見たら古かった。

$ /usr/local/MacGPG2/bin/gpg-agent --version
gpg-agent (GnuPG/MacGPG2) 2.0.30
libgcrypt 1.7.0
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

というわけでgpg-agentを再起動します。

kill -KILL 598
kill -KILL 458

gpg-agent --daemon

解決! ✨

たぶんですが最初にGPGの導入作業をしたときに色々試行錯誤してbrewで入れたものとGUIで入れたものがごっちゃになっていたため発生したと思われます...。