Skip to content

Sign your commits and tags

Anyone can write Jane Doe <jane@example.com> into a commit. Git does not check. A signature fixes that: you sign the commit with a key only you hold, and anyone with the matching public key can check that the commit is yours and has not been changed since.

That is what the green Verified shield on GitHub, GitLab or Codeberg means, and what the shield next to a commit in History shows in this app.

Git can sign with an SSH key, the same kind you use to push. The app does not do the signing itself: it sets three options in the git config, and from then on git signs every commit it makes. That includes commits from revert, cherry-pick, merge and rebase, not only the ones you type a message for.

Two separate things are involved:

  • Signing needs your private key. Turn it on once.
  • Verifying needs a list of who may sign with which key. For SSH, git calls that list an allowed signers file: one line per person, with an email address and a public key. Without that file git cannot say a signature is good, only that one exists.
  1. Click the gear (Settings) in the top bar and open the Credentials tab. Scroll to Commit signing, below SSH keys. No key yet? Make one under SSH keys first.
  2. Under Where, choose Only in the current repository, or All repositories (your global git config). With no repository open only the global choice is there.
  3. Pick the key in SSH key. A key with a passphrase is marked with a hint (see below).
  4. Leave Also show my own commits as verified in History ticked if you want verification (see below), then press Turn on signing….
  5. The app first shows what it will change: each config key with the old and the new value, and the line it will add to the allowed signers file. Nothing has changed yet. Press Apply, or Cancel.

Commit signing in Settings, with the scope choice, a key picked, and the list of config changes shown before Apply

The status line above the form tells you what is in force, for example “Commits in tidewatch are signed with the SSH key id_ed25519, from …”. Turn off… shows a plan the same way.

Hosts show your commits as verified only after you add the public key to your account there as a signing key. The app says so below the form.

If the remote is on GitHub, GitLab, Forgejo or Gitea and you have added a token for that host under Settings → Credentials → Forge tokens, the form also has Add id_ed25519 to . One click sends the public key to your account there as a signing key, titled “Git Client MX (id_ed25519)”, and the app shows the page where you can see it. The private key never leaves your computer. If the host already has the key, the app says so and changes nothing. The token needs permission to manage your keys (on GitHub the write:ssh_signing_key scope or a fine-grained token with SSH signing keys write access).

In History, a commit with a signature has a small shield before its subject. Hover for the words. The colour tells the state:

Shield Words Meaning
Green Signed and verified (with “by” and the email) The key is in your allowed signers file.
Grey Signed, not verified A signature exists, but git cannot confirm it (see below).
Red Bad signature The commit changed after signing, or the signature is not from that key.
Amber Signature or key expired The signature or its key has expired.
Red Signed with a revoked key The key has been revoked.

Unsigned commits have no shield. Select a commit and its details show the same line with the format (SSH, GPG or X.509), the key fingerprint and, if it is one of yours in ~/.ssh, “(your key id_ed25519)”, plus a sentence on why it is not verified, if it is not. Some of these sentences end in a link Set up verification… that jumps to the settings.

The grey shield has three causes, each in its own words:

  • Git has no allowed signers file: “Git can only verify SSH signatures with an allowed signers file, a list of who may sign with which key.”
  • The key is not in your allowed signers file, or (GPG) GPG does not trust the key.
  • Git could not check it: ssh-keygen or gpg is missing, or the public key is not known.

Your own commits are most often the first. Press Set up verification… (under the form, or in the commit details). The app then writes an allowed signers file in its own folder, with one line: your user.email and your public key, and points gpg.ssh.allowedSignersFile at it. It needs your email address to be set. If you already use a different allowed signers file, the app leaves it alone and tells you; add your key to that file yourself.

Git asks for the passphrase at every commit. The app shows the question in its own dialog. If you cancel, or type it wrong, the commit fails with “Signing needs the passphrase of your SSH key: type it when asked, or add the key to ssh-agent. Staged changes stay staged.” If the key is loaded in ssh-agent (ssh-add), git uses it from there and nothing is asked.

The app leaves GPG alone. It shows “You sign commits with GPG. The app leaves that as it is, unless you choose to replace it with SSH below.” To switch, tick Replace GPG signing with this SSH key; without it Apply stays disabled.

If you would rather use a key you already have in GPG (OpenPGP) or in gpgsm (X.509), use Or sign with a GPG or X.509 key under the SSH keys in Settings. Pick the Type, press Find my keys, choose a key and press Turn on signing…. The app only runs gpg or gpgsm when you press Find my keys, and it only reads the list of your secret keys; it never creates, changes or exports one. The program is the gpg.program (or gpg.x509.program) from your global git config, otherwise gpg or gpgsm from your path. A repository’s own config is not used for that, so a repository can’t choose what the app starts.

The review shows the three settings that change: gpg.format (openpgp or x509), user.signingkey (the fingerprint of the key) and commit.gpgsign. A key that has expired is listed, marked (expired), and not preselected. If you have no secret keys yet, the app says so; make one first, for example with gpg --full-generate-key. A key with a passphrase is asked for by gpg itself (pinentry), not by the app.

A release is usually marked with a tag, and a signed tag tells people that the release really comes from you. The same key and the same settings are used.

  1. In History, right-click the commit you want to tag and choose Create tag here…. In Branches you can do the same from the toolbar (New tag, on the commit you are on) or from a local branch’s menu (Create tag here…, on the tip of that branch).
  2. Give it a Name, for example v1.2.0.
  3. Add a Message if you want. That makes the tag annotated: it keeps who made it and when.
  4. If a signing key is set up, tick Sign the tag. With an SSH key the box says Sign with your SSH key “id_ed25519”. It is ticked already when you sign your commits.
  5. Press Create.

So there are three kinds of tag, depending on what you fill in:

You give You get
A name A light tag: only a label on the commit
A name and a message An annotated tag
A name, a message and the tick A signed tag. The message is required for this one.

Without a signing key the box doesn’t appear. The dialog says To sign tags, choose a signing key under Settings › Credentials › Commit signing.

Signing tags doesn’t depend on Turn on signing for commits. Git signs a tag as soon as there is a key, and for SSH the key has to be readable. The app deliberately doesn’t switch on tag.gpgsign in your config.

Forgot to sign a release? Open Branches, right-click the tag and choose Sign tag…. The tag stays on the same commit, but the name now points to a signed version of it. The dialog suggests the tag’s own message (a light tag gets its name), which you can change.

Two things to know. A tag can’t be edited, so this replaces the tag. If you had already pushed the old one, the remote keeps it until you push the new one yourself; the app never pushes tags. And Undo puts the old tag back. If signing fails, the tag is left exactly as it was.

Open Branches (Ctrl+3). A signed tag has a shield next to its name, with the same colours and words as a signed commit (see the table above). While the app is still asking git to check it, the shield is grey and says Signed, not checked yet.

Right-click a tag in Branches and choose Details…. The dialog shows the commit (short hash and subject), who made the tag and when, and the full message of an annotated tag. A light tag has no message and no tagger, and says so. For a signed tag it also shows the signature: the format (SSH, OpenPGP or X.509), the result of the check and why, who signed, the key fingerprint, and whether it is one of your own keys from ~/.ssh.

Some versions of git (2.43, for example) still create an unsigned tag when signing fails, and report success. The app doesn’t trust that. After creating the tag it checks that the signature is there. If it isn’t, it removes the tag again and shows the same message as a failed commit signing, such as Signing needs the passphrase of your SSH key (see above). You never end up with an unsigned tag you thought was signed.

Apply writes these keys, with git config --global or --local depending on Where (--local is the .git/config of the repository):

gpg.format = ssh
user.signingkey = <path to the .pub file of the key>
commit.gpgsign = true

and, with verification, gpg.ssh.allowedSignersFile = <the app's allowed_signers file>. The key is the .pub file: ssh-keygen then signs through ssh-agent if it has the key, and otherwise with the private key next to it.

Turn off… removes commit.gpgsign; gpg.format and user.signingkey stay, so you can still verify old commits. Turned off in one repository while the global config signs, it sets commit.gpgsign = false there.

History reads the signature from the commit object and asks git to check it with git log --no-walk --format=%G?…. It only does so for the commits in view, and remembers the answer for ten minutes; changing settings in the app clears that.

Tags: Create tag here… runs git tag <name> <commit>, with --annotate --message <message> for an annotated tag and --sign --message <message> for a signed one. Branches lists the tags with one git for-each-ref refs/tags, reading the signature part of each, and runs git verify-tag only for the tags that have a signature. The states, the reasons and the ten-minute memory are the same as for commits.

The messages come from git, translated into the app’s words:

  • Passphrase wrong or cancelled. See above. Your staged changes stay staged; commit again.
  • A revert that could not be signed. Git applies the revert but does not commit it, and leaves the changes staged. If nothing else was changed in your working folder, the error in History has two buttons: Try again (after you fixed the key or turned signing off) and Discard changes, which throws the staged changes away after a snapshot. With changes of your own in the folder the buttons are not there, because the app cannot tell what is whose: commit or unstage them in Changes. A cherry-pick that could not be signed stays a running operation, with Continue and Abort at the top.
  • “Git could not run ssh-keygen (OpenSSH 8.2 or newer)”. Install OpenSSH, or turn signing off.
  • “The signing key (user.signingkey) no longer exists.” You deleted or moved the key. Choose another in Settings, or turn signing off. Settings also warns about this in red while the key is missing.
  • “There is no public key (.pub) next to the signing key.” Git can still sign; the app just cannot show which key it is.
  • You can’t tick Sign the tag. There is no signing key in your settings, or, for an SSH key, the app can’t read it. Set one under Settings, Credentials, Commit signing.
  • Create stays disabled for a signed tag. A signed tag needs a message as well as a name.