Skip to content
Versora

Manual

Servers and accounts

GPG keys

4 min read

On this page

A GPG (OpenPGP) key signs commits and tags: the server shows the commit as verified when the public key is registered on your account. The GPG keys group in Preferences › SSH and GPG keys lists the secret keys in your keyring, generates a new key and sets it up for signing.

Tip

On Windows, signing with an SSH key is usually less hassle: it doesn't depend on gpg-agent, and the same key works for connecting and for signing. See SSH keys.

Where to find it

  • Preferences (Ctrl+,) › SSH and GPG keys › GPG keys group.
  • Palette (Ctrl+P): "Preferences: SSH and GPG keys".

Which GPG Versora uses

The group title shows the program and the keyring: the GPG that ships with Git for Windows ("(the one that ships with Git)"), the one configured in gpg.program or another one on the PATH, and "keys in …" with the keyring folder. With no GPG at all: "No GPG was found (not even the one that ships with Git for Windows). To sign commits without GPG, use an SSH key: the “Use to sign commits” button on the SSH key above."

The key list

Each key shows the ID, the first identity (name and email), the fingerprint (in the tooltip), the dates and badges:

Badge or textMeaning
created …, expires … / expired … / no expirationThe key's dates.
+2 identitiesThe key has more identities besides the one shown.
expired or unusableThe key can no longer sign.
can't signThe key has no signing capability.
signs commitsIt's the signing key in effect.

Buttons: Copy public key ("GPG public key copied to the clipboard."), Upload to server… and Use to sign commits…. With no keys: "No secret GPG keys in this keyring."

Generating a GPG key

The key is generated for the Git identity (name and email from Preferences › Profile). Without an identity, the form asks: "To generate a GPG key, first set your name and email in Git." with Open Profile.

Step by step

  1. Click Generate new GPG key….
  2. Check the identity: "Identity: Ana Souza <[email protected]> (from Profile). Type ed25519, for signing, with an encryption subkey."
  3. In Key passphrase (optional) and Confirm passphrase, type the passphrase (empty = no passphrase).
  4. In Expiration, choose 1 year, 2 years, 5 years or No expiration.
  5. Click Generate GPG key. You see "GPG key 3AA5C34371567BD2 created for [email protected]."
OptionWhat it doesDefault
Key passphrase (optional)Protects the private key. gpg-agent asks for the passphrase when signing.empty
ExpirationWhen the key expires.2 years

Uploading the key to the server

  1. On the key, click Upload to server….
  2. The Upload the GPG key to a server dialog shows the key ("Key 3AA5C34371567BD2 · Ana Souza <[email protected]>") and reminds you that only the public key leaves this machine.
  3. In Server, choose the GitLab or GitHub. On GitHub, Name (GitHub only) gives the key a name.
  4. Click Upload. The Key added dialog confirms and offers Open the keys page.

Token scopes: GitLab api; GitHub write:gpg_key. Without a server with a token, the dialog explains and offers Open Git servers; you can also copy the public key and paste it on your account's keys page.

Signing commits with the GPG key

  1. On the key, click Use to sign commits….
  2. The Sign commits with this GPG key dialog explains: "Sets in the global Git configuration: commit.gpgsign = true and user.signingkey = 3AA5C34371567BD2 (OpenPGP format)." and says which program signs (the one in gpg.program or the gpg that ships with Git, the same one that holds the key).
  3. Click Use for signing. You see "Commits will now be signed with the GPG key 3AA5C34371567BD2."
bash
git config --global commit.gpgsign true
git config --global user.signingkey 3AA5C34371567BD2

To sign in a single repository only, use Preferences › Commit (see Commits).

How to undo

Nothing here is part of Ctrl+Z. To stop signing, change it in Preferences › Commit.

Caveats and messages

  • "A GPG key for "Ana Souza <[email protected]>" already exists. Use the existing one (listed above)."
  • "gpg couldn't start gpg-agent, which it uses to generate the key." with the gpg output.
  • "Enter the identity's name and email (Preferences › Profile)."
  • "This doesn't look like a GPG public key (BEGIN PGP PUBLIC KEY BLOCK block)."
  • "The token registered for github.com can't add keys. Create a token with the "write:gpg_key" scope… and update it in Git servers."
  • Push rule that requires signed commits: see Push rules.
  • Preferences › Commit: global and per-repository signing, format and key.
  • The company policy can hide this page (preferences.hidden: [keys]). See Administrators.

See also