To make my commits marked as “verified” on GitHub, I tried to sign them locally using GPG. It worked fine using the following command line command:
> git commit -S -m your commit message
But when I tried to sign commits within JetBrains IDEs, like Clion, things did not work out so easily. JetBrains IDEs do not provide native supports/integrations for GPG. So I need to make use of GPG Suite to sign commits automatically without being prompted for password from the terminal. This post records how to do so.
> brew cask install gpg-suite
> gpg --full-generate-key
RSA and RSA for encryption method,
4096 for key size.
> gpg --list-secret-keys --keyid-format LONG
Copy the GPG key, beginning with
-----BEGIN PGP PUBLIC KEY BLOCK----- and ending with
-----END PGP PUBLIC KEY BLOCK-----. Add the GPG key to GitHub account.
> git config --global user.signingkey B31AD9AD2B5CFABD
export GPG_TTY=$(tty) to
.bashrc and etc.
When you store a password in macOS keychain, pinentry, the program used to ask for your password, will never again ask for that password. macOS will remember this password and automatically use it when needed. That means you will no longer see the pinentry dialog querying for your password. The password is protected with your macOS user password.
Choose ‘Store in OS X Keychain’ option when the pinentry dialog asks for the password.