My step by step guide
Linux
1. Installing Kleopatra + GPG
On Debian/Ubuntu:
Open your terminal and paste the following:
sudo apt update
sudo apt install kleopatra gnupg2 -y
For Arch-based systems:
sudo pacman -S kleopatra gnupg
For Fedora:sudo dnf install kleopatra gnupg2
2. Verify GPG Works
Check if GPG is installed correctly:
gpg --version
Should show version info like:
gpg (GnuPG) 2.4.4
version numberHome: /home/username/.gnupg
installment location
3. Create a GPG Key
Launch Kleopatra or use terminal:
GUI (Kleopatra):
- Open Kleopatra
- Click File > New Certificate
- Follow the wizard to create a personal OpenPGP key
Terminal:
gpg --full-generate-key
Choose:
- Key type:
1
(default) - Key size:
4096
- Expiration: your choice (e.g.
1y
) - Name/email/comment as prompted
Then list the key:
gpg --list-secret-keys --keyid-format=long
Look for the key ID after sec
(e.g. rsa4096/
YOURKEYID
)
4. Add GPG Key to GitHub
A. Export your public key:
gpg --armor --export YOURKEYID
Copy the entire output (starts with like -----BEGIN PGP PUBLIC KEY BLOCK-----
)
B. Add to GitHub:
- Go to GitHub GPG Settings
- Click New GPG key
- Paste the key and click Add GPG Key
- Confirm with your GitHub password if prompted
5. Tell Git to Use Your GPG Key
git config --global user.signingkey YOURKEYID
git config --global commit.gpgsign true
(YOURKEYID should be your key id, and not the word YOURKEYID)
Also tell Git which GPG program to use:
git config --global gpg.program gpg
6. Set Up in VS Code
Option A: Using GUI
- Open VS Code
- Go to Settings (Ctrl+,)
- Search for GPG
- Enable Git › Enable Commit Signing
Option B: Manually edit settings.json
Open via Command Palette (Ctrl+Shift+P → Preferences: Open Settings (JSON)):
{
"git.enableCommitSigning": true
}
7. Fix: gpg: skipped "yourID": No secret key
If you get:
Git: gpg: skipped "yourID": No secret key
It usually means the key isn’t loaded or you generated it with another user. Run:
gpg --list-secret-keys --keyid-format=long
Confirm the ID matches git config --global user.signingkey
. If not, correct it.
If using gpg2
, make sure Git is pointing to it:
git config --global gpg.program $(which gpg)
Also ensure gpg-agent
is running. If not:
gpgconf --launch gpg-agent
8. Optional: Autostart Kleopatra
To make Kleopatra start on boot:
- Open your file manager
- Go to
~/.config/autostart/
- Create the folder if it doesn’t exist
- Create a file
kleopatra.desktop
with:
[Desktop Entry]
Type=Application
Exec=kleopatra
Hidden=false
NoDisplay=false
X-GNOME-Autostart-enabled=true
Name=Kleopatra
- Save and reboot or log out/in to test
Windows
- Installing Kleopatra
-
- go to de download and download the latest version
- click on
Check integrity
- scroll down to
SHA256 checksums
- now open powershell
- type
Get-FileHash
- Drag your download into the powershell, this is mine:
Get-FileHash C:\Users\Gebruiker\Downloads\gpg4win-4.2.0.exe
, this will look different for newer versions - press Enter
- Check if the hash is the same as on the website, if not, try again or with another version. Otherwise you risk installing a tinkererd version, like malware. (If the letters are upper/lower cased incorrectly, that doesn’t matter)
- Easiest way to check if it is the same is by using Ctrl+F in your browser
- double click the file to install
-
- How to add to github:
- this document should explain the steps
- If you cant figure it out, here is a step by step guide:
- In the upper-right corner of any page, click your profile photo, then click Settings
- In the “Access” section of the sidebar, click  SSH and GPG keys.
- Next to the “GPG keys” header, click New GPG key.
- In the “Title” field, type a name for your GPG key.
- In the “Key” field, paste the GPG key you copied when you generated your GPG key.
- Click Add GPG key.
- To confirm the action, authenticate to your GitHub account.
- tell git you want to use a gpg key:
- github docs
- keep in mind: you need to run commands in
git bash
, not incmd
, but if nothing happens ingit bash
, trycmd
- how to add to vscode:
- put the following in your vscode settings.json:
"git.enableCommitSigning": true
or Open the settings, search for “gpg” and check the box “Enables commit signing with GPG” - this article explains it. (you can start at
Set up VS Code
)
- put the following in your vscode settings.json:
- If you get an error with committing
Git: gpg: skipped "yourID": No secret key
:- put
git config --global gpg.program "C:\Program Files (x86)\GnuPG\bin\gpg.exe"
in your console - or follow this guide
- put
You also might want to add Kleopatra to startup to avoid having to wait minutes for it to startup when wanting to commit:
- press Win to enter search
- type “kleopatra”
- klick
open file location
- copy the shortcut to kleopatra
- find the startup folder
- paste the shortcut here.