Skip to content
Versora

Manual

Commits

Commit signing

9 min read

On this page

A signed commit carries a cryptographic signature made with a key of yours. GitLab and GitHub check the signature against the public key registered in your account and show the commit as verified. Some push rules reject unsigned commits.

Versora doesn't sign on its own: it writes git's signing configuration, and git commit itself does the signing. That's why signing works the same in Versora and on the command line.

The formats git accepts:

FormatKey usedNote
OpenPGP (GPG)A GPG key (its ID, such as 3AA5C34371567BD2)It's git's default
SSHAn SSH key (the public key file, such as ~/.ssh/id_ed25519.pub)On Windows it's usually less work: it doesn't depend on gpg-agent, and the same key works for connecting and for signing
X.509 (S/MIME)A certificate (its ID)For companies that use certificates

Generating, listing, testing and uploading keys to GitLab and GitHub is covered in SSH keys and GPG keys. This page is about using a key that already exists for signing.

What is in effect

Where to find it

  • Preferences (Ctrl+,) › Commit, at the top of the signing part.
  • Palette (Ctrl+P): "Preferences: commit and signing".

Step by step

  1. Open the repository in a tab (to see what applies to it) and go to Preferences › Commit.
  2. Read the box: "In effect in app-web: commits are signed" (or "commits are not signed"). With no repository open, the box says "In effect for your repositories:".
  3. With signing on, the line below shows the key and the format, for example "Key ~/.ssh/id_ed25519.pub · SSH format".

What the box can show when signing is on:

TextMeaning
"Key 3AA5C34371567BD2 · OpenPGP (GPG) format"The configured key and format
"No key set: GPG picks the key from your email"OpenPGP format without a key: GPG looks for a key with your email
"No key set: SSH signing will fail"SSH format without a key: the box turns yellow, because git doesn't know which key to sign with

The box shows the effective value, from any source: global configuration, the repository's, or an identity rule by folder or by server (see Identity).

What Versora does in git

It only reads the configuration:

bash
git config --list --show-scope -z            # what applies here (follows include and includeIf)
git config --global --list --show-scope -z   # only the global file, for the global form

From both reads, the app uses commit.gpgsign, user.signingkey and gpg.format.

See also

Global signing

Global signing applies to all repositories that don't have a rule of their own. It lives in your global git configuration.

Where to find it

  • Preferences › Commit › Commit signing — global.

Step by step

  1. Go to Preferences › Commit › Commit signing — global. The note says: "Writes commit.gpgsign, user.signingkey and gpg.format to the global Git configuration. The chosen key must exist on this machine: to create a new SSH or GPG key, use the SSH and GPG keys page." That page is in Preferences › SSH and GPG keys (see SSH keys and GPG keys).
  2. Turn on Sign all commits.
  3. In Format, choose OpenPGP (GPG), SSH or X.509 (S/MIME) (or leave Git default (OpenPGP)).
  4. In Signing key, enter the key. The field shows an example that depends on the format: "GPG key ID (e.g. 3AA5C34371567BD2)", "SSH public key (e.g. ~/.ssh/id_ed25519.pub)" or "Certificate ID".
  5. Click Save global signing. "Global signing saved." appears.
  6. Before saving, Undo changes puts the fields back to what is saved.
  7. Make a test commit. If signing fails, the commit box tells you (see When signing fails).
OptionWhat it doesDefault
Sign all commitsGlobal commit.gpgsignOff (git doesn't sign without this setting)
Signing keyGlobal user.signingkey. Empty removes the keyEmpty
FormatGlobal gpg.format: Git default (OpenPGP) removes the setting; the others write openpgp, ssh or x509Git default (OpenPGP)

Turning off Sign all commits writes commit.gpgsign = false; if the option had never been set, nothing is created.

What Versora does in git

bash
git config --global --replace-all commit.gpgsign true
git config --global --replace-all user.signingkey ~/.ssh/id_ed25519.pub
git config --global --replace-all gpg.format ssh
# empty field or "Git default (OpenPGP)": the key is removed from the configuration
git config --global --unset-all gpg.format

The following commits, in Versora and on the command line, are signed. Older commits don't change.

How to undo

Configuration changes don't go into Ctrl+Z. To go back, turn off Sign all commits (or adjust the fields) and save again.

Caveats and messages

  • "The SSH format requires a signing key.": the save button stays disabled until you enter the key.
  • "The signing key can't contain line breaks.": paste only the path or the ID.
  • "Invalid signing format: … (use openpgp, ssh or x509).": an unknown format value.
  • "Couldn't write the Git configuration (file locked or no permission).": the global configuration file is open in another program or has no write permission.
  • "Couldn't read the Git configuration: Git 2.26 or newer is required.": update git.
  • "Reading the Git configuration…": the page is still loading.
  • Preferences › Commit. The company policy can make the page read-only.

See also

Per-repository signing

To sign in just one repository (your work one, for example), or to not sign in a specific repository, use the repository rule. It lives in the repository's local configuration and takes precedence over the global one.

Where to find it

  • Open the repository in a tab › Preferences › Commit › Signing in this repository app-web.
  • With no repository open, the group is called Per-repository signing and says "Open a repository in a tab to set a signing rule just for it."

Step by step

  1. With the repository in the active tab, go to Preferences › Commit. The group's note says: "Only for this repository (git config --local). Empty fields follow the global configuration."
  2. In Sign commits, choose Always sign in this repository, Never sign in this repository or Use the global configuration (signs) / Use the global configuration (doesn't sign).
  3. If this repository uses another key, fill in Signing key. Empty uses the global one (the field shows the global one, for example "3AA5C34371567BD2 (global)").
  4. In Format, leave Use the global configuration or choose another one.
  5. Click Save repository signing. "Signing for "app-web" saved." appears.
OptionWhat it doesDefault
Sign commits › Use the global configuration (…)Removes commit.gpgsign from the repositorySelected
Sign commits › Always sign in this repositoryLocal commit.gpgsign = true—
Sign commits › Never sign in this repositoryLocal commit.gpgsign = false—
Signing keyLocal user.signingkey; empty follows the global oneEmpty
Format › Use the global configurationRemoves gpg.format from the repositorySelected
Format › OpenPGP (GPG) / SSH / X.509 (S/MIME)Local gpg.format—

What Versora does in git

bash
git config --local --replace-all commit.gpgsign true
git config --local --replace-all user.signingkey 3AA5C34371567BD2
git config --local --unset-all gpg.format     # "Use the global configuration"

How to undo

Set the options back to Use the global configuration and save. That removes the keys from the local configuration; the repository follows the global one again. There's no Ctrl+Z for configuration.

Caveats and messages

  • "The SSH format requires a signing key.": with Always sign (or following a global configuration that signs), the SSH format and no key, neither local nor global.
  • "Open a repository to change its configuration.": the active tab isn't a repository.
  • The local configuration lives in .git/config: it doesn't go with the push and doesn't apply to your colleagues.

See also

Use an existing key for signing

On the keys page, an existing SSH or GPG key can become the signing key with one click. It's the shortest path when you've just generated the key.

Where to find it

  • Preferences › SSH and GPG keys › on the key's row, Use to sign commits…. The key that already signs shows "signs commits".
  • The top of the page shows "Commit signing: on" (or "off"), the key and the format, and the Change in Commit button, which takes you to Preferences › Commit.
  • Palette (Ctrl+P): "Preferences: SSH and GPG keys".

Step by step

  1. Open Preferences › SSH and GPG keys.
  2. On the key that will sign, click Use to sign commits….
  3. Read what will be written:
    • SSH key: "Sign commits with this SSH key" — "Sets in the global Git configuration: commit.gpgsign = true, gpg.format = ssh and user.signingkey = …". The app also adds the key, with your email, to the allowed_signers file and points to it in gpg.ssh.allowedSignersFile, so that git recognizes your signatures as valid;
    • GPG key: "Sign commits with this GPG key" — "Sets in the global Git configuration: commit.gpgsign = true and user.signingkey = 3AA5C34371567BD2 (OpenPGP format)."
  4. Click Use for signing. "Commits will now be signed with the SSH key id_ed25519." appears (or "… with the GPG key 3AA5C34371567BD2.").
  5. For GitLab or GitHub to show the commits as verified, register the public key in your account (on GitHub, as a signing key). See SSH keys and GPG keys.

What Versora does in git

bash
# SSH key (the public key path goes with forward slashes)
git config --global --replace-all commit.gpgsign true
git config --global --replace-all user.signingkey C:/Users/ana/.ssh/id_ed25519.pub
git config --global --replace-all gpg.format ssh
# with your email set: the key goes into ~/.ssh/allowed_signers and the file is pointed to
git config --global gpg.ssh.allowedSignersFile C:/Users/ana/.ssh/allowed_signers

# GPG key (the format goes back to git's default, OpenPGP)
git config --global --replace-all commit.gpgsign true
git config --global --replace-all user.signingkey 3AA5C34371567BD2
git config --global --unset-all gpg.format

The line added to allowed_signers has the form [email protected] namespaces="git" ssh-ed25519 AAAA…; it isn't repeated if it's already there.

How to undo

In Preferences › Commit, turn off Sign all commits and save (or adjust the key).

Caveats and messages

  • "Set your email in Profile so Git can also verify your signatures (allowed_signers).": without an email, the SSH key signs, but the local git can't check it.
  • "To sign in just one repository, use Preferences › Commit.": the button always writes to the global configuration.
  • "No GPG was found (not even the one that ships with Git for Windows). To sign commits without GPG, use an SSH key: the “Use to sign commits” button on the SSH key above.": without GPG, sign with an SSH key.

See also

When signing fails

When git can't sign, the commit isn't created. The commit box shows git's output and explains that the problem is the signing.

Where to find it

  • Commit box › Commit options › "The commit was not created" box.

Step by step

  1. Read the sentence in the box: "Commit signing failed. Check the key and format in Preferences › Commit."
  2. Click the Preferences › Commit link in the box.
  3. Check the format and the key (see the sections above). Common causes:
    • SSH format without a key, or a key path that doesn't exist;
    • an expired GPG key, or one that isn't in the keyring of the GPG that git uses;
    • GPG not installed, or the GPG agent asking for a passphrase that never arrives.
  4. Fix it and commit again. The message stays in the box.

What Versora does in git

The same git commit -F -; it's git that tries to sign (or the gpg, ssh-keygen or gpgsm it calls).

How to undo

Nothing was recorded: the commit doesn't exist.

Caveats and messages

  • The sentence shows up when git's output mentions a signing failure (for example "gpg failed to sign the data", "secret key not available" or ssh-keygen errors).
  • Push rule "Reject unsigned commits": before the commit, the "Before committing: push rules" dialog may show "The commit won't be signed (signing is off in this repository)", with Set up signing… (opens Preferences › Commit). See Checks.

See also