GPG - GNU Privacy Guard

Setup

Installation

Visit https://www.gnupg.org/download/ and download the latest binary for your operating system.

For macOS

Using Homebrew:

$ brew install gnupg

Add this to your ~/.zshrc:

# Fixing "gpg: signing failed: Inappropriate ioctl for device"
GPG_TTY=$(tty)
export GPG_TTY

Make sure the gpg command is available on the command line.

Generate a key pair

Hint

Have a sufficiently strong passphrase ready before starting the generation.

To generate a key pair run

$ gpg --full-generate-key

Follow the instructions provided on Github.

Add PGP verification

For GPG to work the sender (local git repository) must have access to the public and private key. The corresponding server (for example Github or Bitbucket) must be aware of your public key.

Client

Note

Not each client supports GPG signing of your commits.

Pycharm

Pycharm lets you add GPG keys for each individual local git repository.

  1. Open Preferences ‣ Version Control ‣ Git.

  2. In the Commit section select Configure GPG keys.

  3. Select Sign commit s with GPG key and select your generated key from the dropdown menu.

  4. Confirm with OK.

Server

Github

Multiple GPG keys can be added to your account, valid for any for your repositories.

Follow the latest instructions on Github to add a new GPG key.