Importing pgp keys from keybase into gpg

This can be useful for a number of things including singing git commits which uses gpg.

If you don't have gpg already installed, you can install it with most package managers on unix systems, on macos you can brew install gpg.

Assuming you have published your public and private keys, simply install gpg, and then you can import them directly.

# Import the public key
$ keyabse pgp export | gpg --import

# Import the private key
$ keybase gpg export -s | gpg --allow-secret-key-import --import

During the second command, you may be asked by keybase to authenticate and create a passphrase for the key. Read these carefully and make sure to store your passwords using a password manager.


If you're getting the following error, you might not have told GPG what TTY to use to ask for a passphrase.

error: gpg failed to sign the data
error: unable to sign the tag

This can be fixed in a few ways, first you can tell GPG to use the current TTY via:

$ export GPG_TTY=$(tty)

Or, a more popular option is to install pinentry via brew install pinentry.