MacOS Jetbrain commit failure when sign with a passphrase encoded gpg key solved

My MacBook was re-initialized recently and I have to set up my working environment from zero. I encountered a problem when commit my code to git repository, the git program just complaint a error message in git console:

error: gpg failed to sign the data
fatal: failed to write commit object

After researching, I guess it's because jetbrains have problem working with pinentry program which is used by gpg to ask user for passphrase. Jetbrains have a issue about this: https://youtrack.jetbrains.com/issue/IDEA-127802/Git-commit-fails-if-GPG-signing-is-enabled.

From this issue, I changed the gpg-agent pinentry program by modifying ~/.gnupg/gpg-agent.conf, adding an option:

pinentry-program /usr/local/bin/pinentry-mac

Note: if you don't have this pinentry-mac on your system, just brew install pinentry-mac it.

Then restart gpg-agent:

gpgconf --kill all
gpg-agent --daemon

If the agent starts, this problem should be solved. pinentry-mac will ask user for passphrase by prompting a dialogue rather than displaying message in console.

此条目发表在Misc分类目录,贴了, 标签。将固定链接加入收藏夹。

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据