Skip to content
Search Fedora

    Browse this documentation

    Git, fully: GPG-signed commits, SSH signatures, and multi-identity switching

    Fedora ships git 2.55.0 with every signing capability built in. This page covers both routes to a Verified badge on GitHub/GitLab.

    Terminal window
    gpg --batch --passphrase "" --quick-gen-key \
    "Your Name <[email protected]>" ed25519 sign 1y

    Measured working out of the box on Fedora 45 (GnuPG 2.4.9); ed25519 is fast and produces short signatures. 1y is the expiry, extendable later with --quick-set-expire.

    Get the key fingerprint:

    Terminal window
    gpg --list-keys --keyid-format long [email protected]
    Terminal window
    git config --global user.name "Your Name"
    git config --global user.email "[email protected]"
    git config --global commit.gpgsign true
    git config --global user.signingkey <fingerprint-or-email>
    Terminal window
    git commit -m "signed"
    git log --show-signature -1

    Measured output:

    gpg: Signature made Thu 29 Oct 2026 02:59:26 AM UTC
    gpg: using EDDSA key 6F559EB9AF396AAE7799237AB812682FB6341EE3

    git log --format="%G?" -1 printing G means a valid signature. Upload the public key to GitHub (Settings → SSH and GPG keys) and commits show the Verified badge.

    git 2.34 and later can sign with SSH keys — you already maintain those, no second toolchain.

    Terminal window
    # 1. a dedicated signing key (or reuse your login key)
    ssh-keygen -t ed25519 -N "" -f ~/.ssh/id_ed25519_sig -C "[email protected]"
    # 2. tell git to sign with SSH and which key
    git config --global gpg.format ssh
    git config --global user.signingkey ~/.ssh/id_ed25519_sig.pub
    # 3. verification allowlist (without it, local verification never says Good)
    echo "[email protected] $(cat ~/.ssh/id_ed25519_sig.pub)" > ~/.ssh/allowed_signers
    git config --global gpg.ssh.allowedSignersFile ~/.ssh/allowed_signers

    git log --show-signature reports:

    error: gpg.ssh.allowedSignersFile needs to be configured and exist for ssh signature verification

    and %G? prints N. The signature itself is fine — GitHub still accepts it — only local verification is unavailable. With the allowlist configured:

    Good "git" signature for [email protected] with ED25519 key SHA256:Pqut/KsBJcbpV00quDyPN6rtpmtssWsT8nq5s2UXS8Y

    and %G? becomes G.

    Company repos use the work email, personal repos the private one — a hard-coded --global will leak. Switch by directory:

    Terminal window
    # append to ~/.gitconfig
    [includeIf "gitdir:~/work/"]
    path = ~/.gitconfig-work
    [includeIf "gitdir:~/personal/"]
    path = ~/.gitconfig-personal

    ~/.gitconfig-work:

    [user]
    signingkey = <work-key-fingerprint>

    Verify it took effect:

    Terminal window
    cd ~/work/some-repo
    git config user.email # prints the company address

    Forgot to enable commit.gpgsign before committing:

    Terminal window
    git commit --amend --no-edit -S

    Re-sign the last N unpushed commits:

    Terminal window
    git rebase --exec 'git commit --amend --no-edit -S' HEAD~5

    Never rewrite pushed history — changed signatures change hashes and turn your collaborators’ pulls into conflicts.

    SymptomCause
    gpg failed to sign the datagpg-agent down or pinentry cannot display; test with echo test | gpg --clearsign
    GitHub rejects the GPG signatureemail mismatch — the signing email must be a verified GitHub address
    SSH signature shows N locallygpg.ssh.allowedSignersFile not configured (the signature itself is valid)
    signing fails in CIkey has a passphrase; use a dedicated passphrase-less key or verify-only
    includeIf has no effectpath case or trailing slash mismatch; check with git config --show-origin
    signatures break on a new machinepublic key not uploaded to the platform, or user.signingkey pins the old fingerprint