Signing your commits in VSCode on Fedora 29 & 30

April 17, 2019

Create new GPG Key on Fedora

Generating your GPG key

The guide below is highly inspired by the official guide: Generating a new GPG key. This is more condenses version tailored for Fedora 29. Open terminal and do the following:

  1. Initiate new key generation by running gpg2 --full-gen-key

    • RSA and RSA (default)
    • Keysize: 4096
    • Expires: 0 (key does not expire)
  2. Confirm that the above information is correct: y
  3. Then you will be prompted to supply user information

    • Real Name: your full name
    • Email address: ensure that you use the same one as your GitHub account
  4. Validate a generate a passphrase
  5. You should then see the key in the response gpg: key XXXXXXXXXXXXXXXX marked as ultimately trusted.

Add your GPG key to Github

You will now need to add the full key to your Github account:

  1. First, get the key with the following command: gpg --armor --export XXXXXXXXXXXXXXXX
  2. Then go to Create a new GPG key
  3. Paste the ouput

Git Configuration

  • Configure Git to use gpg2 by running git config --global gpg.program gpg2.
  • Configure Git to use the newly created GPG key by running git config --global user.signingkey XXXXXXXXXXXXXXXX

VSCode Configuration

Enable Commit Signin on VSCode

You need to also configure Visual Studio code:

  • Go to Files → Preferences → Settings
  • Search for enableCommitSigning
  • Enable the setting by checking the checkbox