Commit Signing with gpg in GitKraken Client (2024)

What is Commit Signing?

In Git, you may commit using any name and email address. However, Git supports signing commits and annotated tags using a GPG or SSH key pair.

By signing a commit, other users with your public key can verify the commit was created by the owner of that key. Users can also share their public key with their remote hosting service, such as GitHub, so that commits appear as verified on their website.

Commit Signing with GPG

Requirements

Before you start signing your commits, you will first need to install and configure GPG. Our recommendations to get GPG installed quickly are below.

Note: If you have GitKraken Desktop open, we recommend closing the application before installing GPG.

  • Windows: Gpg4win, simply follow the installer.

  • Mac: We recommend downloading GPG on Mac through Brew. Once you have brew, simply run brew install gpg.

  • Linux: Install gpg through your distribution’s package manager.

    • Debian/Ubuntu: apt install gnupg
    • Fedora: dnf install gnupg2
    • CentOS/RHEL: yum install gnupg2

All GPG download files can be found here.

Once you have installed GPG to your machine, you can verify it is installed and check the version by opening your terminal and running gpg --version.

Note: You may need to replace `gpg` with `gpg2` if you installed GPG2 without an alias. If you have both gpg and gpg2, you will need to prefix with gpg2 if you wish to use the latter.

Commit Signing with gpg in GitKraken Client (1)

Generating a GPG Key In GitKraken

If you have GPG installed on your local machine, you will be able to generate a GPG key pair from within GitKraken Desktop.

Under PreferencesGPG Preferences, there is an option to Generate new GPG Key. If you wish to enter a passphrase, make sure you do so prior to selecting Generate.

Commit Signing with gpg in GitKraken Client (2)

Configure GPG in GitKraken

Once you have GPG installed on your machine, you will need to configure GitKraken to use GPG. Launch GitKraken Desktop and navigate to Preferences → GPG Preferences.

Commit Signing with gpg in GitKraken Client (3)

  • Signing Key: This dropdown list will contain all of your local keys. Select the key you wish GitKraken Desktop to use when signing your commits and annotated tags. If this list is blank you can try the following troubleshoots:

    • You may need to configure the GPG Program setting first.
    • If you installed GPG while GitKraken Desktop was open, you may need to fully close GitKraken Desktop and re-launch it.
  • GPG Program: This is the location of where GPG is installed on your local machine. If GPG is on your path, GitKraken Desktop should automatically detect the GPG program. However, it is possible to have multiple installations of GPG so you can specify which one GitKraken Desktop should point to by using the button.

Commit Signing with gpg in GitKraken Client (4)

If you do not know where GPG is installed on your local machine, launch a terminal and enter: which gpg for Mac & Linux. On Windows, use: where gpg

  • Sign Commits by Default: Enabling this checkbox will have GitKraken Desktop sign any commit you create going forward.

  • Sign Tags by Default: Enabling this checkbox will have GitKraken Desktop sign any annotated tags you create going forward.

  • Generate new GPG Key: GitKraken Desktop will generate a new GPG key for you, see Generating a GPG Key In GitKraken.

Verifying a Local Commit is Signed

You can verify a commit has been signed by selecting a commit and viewing the commit panel. An icon will appear to the left of the commit SHA on signed commits only.

Commit Signing with gpg in GitKraken Client (5)

If you hover over the badge, you will see a tooltip which displays the Signature details.

Commit Signing with gpg in GitKraken Client (6)

Below is a list of possible signature codes and what they mean:

  • GOODSIG — The signature with the keyid is good.
  • EXPSIG — The signature with the keyid is good, but the signature is expired.
  • EXPKEYSIG — The signature with the keyid is good, but the signature was made by an expired key.
  • REVKEYSIG — The signature with the keyid is good, but the signature was made by a revoked key.
  • BADSIG — The signature with the keyid has not been verified.
  • ERRSIG — It was not possible to check the signature. This may be caused by a missing public key or an unsupported algorithm.

Uploading Your GPG Key to a Remote Hosting Service

To upload your GPG public key to your remote hosting service, we recommend viewing the documentation for the respective hosting service:

To copy your GPG public key in GitKraken Desktop, navigate to Preferences → GPG Preferences and below your Signing Key, select Copy GPG Public Key.

Editing Your GPG Key

Editing your gpg key is helpful when you wish to add another email address to a key or renew an expired key. To edit a GPG key, navigate to your terminal and enter gpg --list-secret-keys --keyid-format LONG. This command will output a list of your GPG keys, take note of the ID of the key you wish to edit.

Commit Signing with gpg in GitKraken Client (7)

Now that you have the key ID, you can edit the key. To do so enter gpg --edit-key FFFFFF where FFFFFF is your key ID. You will then enter an editing session with your GPG key. After you update your key, execute a save to record changes and quit editing the key.

Below is a list of useful commands to edit your key:

  • adduid– Add a new user ID to the GPG key
  • deluid – Delete a user ID from the GPG key
  • trust – Change the owner trust value. This updates the trust database immediately and no save is required.
  • expire – Change a key expiration time
  • save – Save all changes to the current key and quit
  • quit – Quit without updating the current key

For a complete list you can review GNU’s documentation.

Make sure to upload the updated key on your hosting service once you have saved. See Uploading Your GPG Key to a Remote Hosting Service.

Deleting your GPG Key

You can delete your key via terminal with the command gpg --delete-secret-keys simply append your username or key ID.

Commit Signing with gpg in GitKraken Client (8)

There will be several prompts to make sure that you really want to delete your GPG key:

Commit Signing with gpg in GitKraken Client (9)

Commit Signing with SSH

Commit Signing with SSH is available in GitKraken Desktop through Git Executable feature.

Commit Signing with gpg in GitKraken Client (10)

Requirements

  • MacOS and Linux: Git and OpenSSH should be pre-installed. To check if are installed, open a terminal and run
    git -v
    ssh -V
  • Windows: Install Git Bash

Create SSH Key

Open a Terminal and run this command:

ssh-keygen -t ed25519 -C "[emailprotected]"

Commit Signing with gpg in GitKraken Client (11)

Enable Git Executable feature

Go to Preferences > Experimental > Git Executable and enable it.

Commit Signing with gpg in GitKraken Client (12)

Select SSH as your GPG format for signing

See this documentation to select the program used for the signing format

At Preferences > GPG > GPG Format, select SSH.

Automatically GitKraken Desktop will change your preferences in .gitconfig and populate GPG SSH Program with ssh-keygen.

Select the signing key

See this documentation to select the signing key

On Signing key, click on Browse and select the .pub key file previously generated.

Create allowed_signers file

This file is needed to verify the key used to sign the commits is valid and known by git.

See this documentation to create the allowed_signers file

On your terminal, run:

touch ~/.ssh/allowed_signersecho "$(git config --get user.email) namespaces="git" $(cat ~/.ssh/<MY_KEY>.pub)" >> ~/.ssh/allowed_signers

And select the file in GitKraken Desktop.

Enable Commit Signing by Default in GitKraken Desktop:

Preferences > GPG > Sign Commits/Tags By default

Add the SSH key to your remote hosting

  • GitHub
  • GitLab
  • Commit Signing verification is not supported on Bitbucket.org
Commit Signing with gpg in GitKraken Client (2024)

FAQs

Commit Signing with gpg in GitKraken Client? ›

SSH signatures are the simplest to generate. You can even upload your existing authentication key to GitHub to also use as a signing key. Generating a GPG signing key is more involved than generating an SSH key, but GPG has features that SSH does not. A GPG key can expire or be revoked when no longer used.

How do I use GPG key to commit? ›

Sign your Git commits
  1. Sign individual Git commits manually: Add -S flag to any commit you want to sign: git commit -S -m "My commit message" Enter the passphrase of your GPG key when asked. ...
  2. Sign all Git commits by default by running this command: git config --global commit.gpgsign true.

What is the difference between SSH and GPG signing? ›

SSH signatures are the simplest to generate. You can even upload your existing authentication key to GitHub to also use as a signing key. Generating a GPG signing key is more involved than generating an SSH key, but GPG has features that SSH does not. A GPG key can expire or be revoked when no longer used.

How to verify git commits with GPG signature? ›

To sign commits using GPG and have those commits verified on GitHub, follow these steps:
  1. Check for existing GPG keys.
  2. Generate a new GPG key.
  3. Add a GPG key to your GitHub account.
  4. Tell Git about your signing key.
  5. Sign commits.
  6. Sign tags.

How do I get my GPG key signed? ›

Signing the key

List the keys currently in your keyring: gpg --list-keys . I want to sign Julian's key, so I pull it into my keyring: gpg --recv-keys 2AD3FAE3 . If Julian's key is already in my keyring, it's a good idea to pull it again, so that my keyring is up to date.

How do I add a signature to a commit? ›

Signing commits
  1. When committing changes in your local branch, add the -S flag to the git commit command: $ git commit -S -m "YOUR_COMMIT_MESSAGE" # Creates a signed commit.
  2. If you're using GPG, after you create your commit, provide the passphrase you set up when you generated your GPG key.

How to use GPG key for SSH? ›

Luckily GPG has some built in functionality that makes this type of public key export just as simple.
  1. 1 gpg --export-ssh-key <key id> > .ssh/id_rsa.pub.
  2. 1 # GPG-Agent. 2 unset SSH_AGENT_PID. ...
  3. 1 enable-ssh-support. ...
  4. 1 killall ssh-agent gpg-agent. ...
  5. 1 debug1: Authentication succeeded (publickey).
Jan 9, 2019

How do I know if my GPG key is signed? ›

Verify using gpg
  1. First find the "key_name" of the key, type the command below and select the key that you need to trust: gpg --list-keys Example of a "key_name" is "Micro Focus Group Limited RSA 2048 1"
  2. Edit the key: gpg --edit-key "key_name"
  3. Enter the command trust and select 5 for trusting the key.

How does GPG signature work? ›

If you sign a file using your personal secret key, anyone can verify that this file has not been modified (i.e. the hash matches the one in your signature) via your public key. GPG signatures are widely used by Linux package managers such as apt to verify the integrity of downloaded files.

Why do we need a GPG key? ›

GPG, also known as GNU Privacy Guard, is very commonly used to digitally sign files in order to guarantee their authenticity.

How do I enable commit signing in git? ›

If you're interested in signing commits directly instead of just the tags, all you need to do is add a -S to your git commit command. To see and verify these signatures, there is also a --show-signature option to git log .

What is the difference between signing key and authentication key? ›

The difference between signing keys and authentication keys is that signing keys can be used to sign Git commits and authentication keys can be used to access repositories. If you add a key as only one type, then it can be used only for that purpose, but the same key may be added for both.

How do I list all GPG keys? ›

Use the gpg --list-secret-keys --keyid-format=long command to list the long form of the GPG keys for which you have both a public and private key. A private key is required for signing commits or tags.

How to use GPG with git? ›

Signing Git Commits Using Your GPG Key
  1. Create a GPG Keypair. This step should only be done by those who don't already have a GPG keypair. ...
  2. Add GPG Support to Git. Now you'll need to configure Git to use your GPG private key for signing. ...
  3. Cache GPG Passphrase Using GPG Agent. ...
  4. Add Your GPG Public Key to GitHub.

What is the difference between SSH key and GPG key? ›

In summary, while both GPG and SSH keys utilize public key cryptography, their primary purposes differ. GPG keys focus on encrypting/decrypting and signing/verifying messages or files, while SSH keys are used for secure remote access and encrypted communication between devices.

Where is my GPG key stored? ›

All secret keys are stored in the private-keys-v1. d directory below the GnuPG home directory.

How do I navigate to a commit? ›

To navigate to a specific commit, click the commit message for that commit. Click on a file in the file tree to view the corresponding file diff. If the file tree is hidden, click to display the file tree. Note: The file tree will not display if your screen width is too narrow or if the commit only includes one file.

How to configure GPG key in Git? ›

Signing Git Commits Using Your GPG Key
  1. which gpg2. ...
  2. brew install gpg2. ...
  3. gpg2 --list-secret-keys | grep sec. ...
  4. sec [Key Length]/[Key ID] [Date Created and Expiry Date] ...
  5. git config --global user.signingkey [your key ID] git config --global gpg.program gpg2. ...
  6. git commit -s -S --amend. ...
  7. git config --global commit.gpgsign true.

How do I add a GPG key? ›

Adding a GPG key
  1. In the upper-right corner of any page on GitHub, click your profile photo, then click Settings.
  2. In the "Access" section of the sidebar, click SSH and GPG keys.
  3. Next to the "GPG keys" header, click New GPG key.
  4. In the "Title" field, type a name for your GPG key.

How do I access my GPG key? ›

Open TerminalTerminalGit Bash. Use the gpg --list-secret-keys --keyid-format=long command to list the long form of the GPG keys for which you have both a public and private key. A private key is required for signing commits or tags.

Top Articles
How Changing Interest Rates Affect Bonds | U.S. Bank
How to set up a MetaMask crypto wallet, your gateway to Ethereum
Asian Feels Login
Craigslist In South Carolina - Craigslist Near You
Kentucky Downs Entries Today
Achivr Visb Verizon
Swimgs Yung Wong Travels Sophie Koch Hits 3 Tabs Winnie The Pooh Halloween Bob The Builder Christmas Springs Cow Dog Pig Hollywood Studios Beach House Flying Fun Hot Air Balloons, Riding Lessons And Bikes Pack Both Up Away The Alpha Baa Baa Twinkle
Best Cav Commanders Rok
Hardly Antonyms
Radio Aleluya Dialogo Pastoral
The Witcher 3 Wild Hunt: Map of important locations M19
Alejos Hut Henderson Tx
Chic Lash Boutique Highland Village
The ULTIMATE 2023 Sedona Vortex Guide
Vanessa West Tripod Jeffrey Dahmer
Ibukunore
Cocaine Bear Showtimes Near Regal Opry Mills
Busted Newspaper Fauquier County Va
Walmart Car Department Phone Number
Understanding Genetics
All Breed Database
Del Amo Fashion Center Map
Jordan Poyer Wiki
TeamNet | Agilio Software
Creed 3 Showtimes Near Island 16 Cinema De Lux
Striffler-Hamby Mortuary - Phenix City Obituaries
Worthington Industries Red Jacket
Askhistorians Book List
Does Circle K Sell Elf Bars
Haunted Mansion Showtimes Near Cinemark Tinseltown Usa And Imax
Little Caesars Saul Kleinfeld
How to Use Craigslist (with Pictures) - wikiHow
Facebook Marketplace Marrero La
Boggle BrainBusters: Find 7 States | BOOMER Magazine
Gets Less Antsy Crossword Clue
2700 Yen To Usd
sacramento for sale by owner "boats" - craigslist
Craigslist en Santa Cruz, California: Tu Guía Definitiva para Comprar, Vender e Intercambiar - First Republic Craigslist
Arigreyfr
Rs3 Nature Spirit Quick Guide
Timothy Warren Cobb Obituary
How To Get To Ultra Space Pixelmon
Craigslist St Helens
UNC Charlotte Admission Requirements
Dineren en overnachten in Boutique Hotel The Church in Arnhem - Priya Loves Food & Travel
Poster & 1600 Autocollants créatifs | Activité facile et ludique | Poppik Stickers
ESPN's New Standalone Streaming Service Will Be Available Through Disney+ In 2025
Zalog Forum
Karen Kripas Obituary
Jesus Calling Oct 6
Predator revo radial owners
Latest Posts
Article information

Author: Foster Heidenreich CPA

Last Updated:

Views: 5368

Rating: 4.6 / 5 (76 voted)

Reviews: 83% of readers found this page helpful

Author information

Name: Foster Heidenreich CPA

Birthday: 1995-01-14

Address: 55021 Usha Garden, North Larisa, DE 19209

Phone: +6812240846623

Job: Corporate Healthcare Strategist

Hobby: Singing, Listening to music, Rafting, LARPing, Gardening, Quilting, Rappelling

Introduction: My name is Foster Heidenreich CPA, I am a delightful, quaint, glorious, quaint, faithful, enchanting, fine person who loves writing and wants to share my knowledge and understanding with you.