How to fix error: ssh signing is not configured. Set user.signingkey and gpg.format in Git

GitBEGINNERLOWUpdated Dec 6, 2025ยท 131 views

This error occurs when you try to sign a Git commit or tag with SSH but haven't configured the required signing settings. The fix involves setting `gpg.format` to ssh and specifying your SSH public key as `user.signingkey`.

Quick fix

Fixes error: ssh signing is not configured. Set user.signingkey and gpg.format

# Check all signing-related configuration
git config --list | grep -E "(gpg|signing)"

# Check specific settings
git config --get gpg.format
git config --get user.signingkey
git config --get commit.gpgsign
  1. Check your current signing configuration
  2. Set gpg.format to ssh
  3. Set your SSH signing key
  4. Enable automatic commit signing (optional)
git โ€” error
# Check all signing-related configuration
git config --list | grep -E "(gpg|signing)"
# Check specific settings
git config --get gpg.format
git config --get user.signingkey
git config --get commit.gpgsign
error: ssh signing is not configured. Set user.signingkey and gpg.format

What this error means

This error indicates that Git is attempting to use SSH for signing commits or tags, but the necessary configuration is missing. Git 2.34 and later supports signing commits with SSH keys as an alternative to GPG keys. When you run `git commit -S` or have `commit.gpgsign` enabled, Git tries to sign the commit. If `gpg.format` is set to `ssh` but `user.signingkey` is not configured, or vice versa, Git cannot proceed with signing and displays this error. SSH signing is simpler than GPG because most developers already have SSH keys for authenticating with GitHub, GitLab, or Bitbucket. Using the same keys for signing reduces the overhead of managing separate GPG keys.

Typical symptoms

  • Commits fail with 'error: ssh signing is not configured'
  • Error message mentions 'Set user.signingkey and gpg.format'
  • Git commit -S fails but regular commits work
  • CI/CD pipelines fail when commit signing is enforced
  • Previously working signing stops after changing git config
  • Error appears after enabling commit.gpgsign in git config

Common causes

  1. gpg.format is set to ssh but user.signingkey is not configured
  2. user.signingkey is set but gpg.format is not set to ssh
  3. SSH public key path in user.signingkey is incorrect or file doesn't exist
  4. Partial configuration from copy-pasted commands missing required settings
  5. Local repository config overrides global signing settings
  6. commit.gpgsign is true but signing configuration is incomplete

How to fix "error: ssh signing is not configured. Set user.signingkey and gpg.format"

1Check your current signing configuration

First, inspect your current Git signing settings to understand what's configured:

bash
# Check all signing-related configuration
git config --list | grep -E "(gpg|signing)"

# Check specific settings
git config --get gpg.format
git config --get user.signingkey
git config --get commit.gpgsign

Expected output for SSH signing:

bash
gpg.format=ssh
user.signingkey=/home/user/.ssh/id_ed25519.pub
commit.gpgsign=true

If gpg.format shows ssh but user.signingkey is empty or missing, that's your problem.

2Set gpg.format to ssh

Configure Git to use SSH for signing instead of GPG:

bash
# Set SSH as the signing format
git config --global gpg.format ssh

This tells Git to use SSH keys for signing rather than GPG keys. The setting name gpg.format is historical - Git originally only supported GPG, so the configuration namespace remained even when SSH support was added.

3Set your SSH signing key

Point Git to your SSH public key for signing:

bash
# For Ed25519 keys (recommended)
git config --global user.signingkey ~/.ssh/id_ed25519.pub

# For RSA keys
git config --global user.signingkey ~/.ssh/id_rsa.pub

# You can also use the literal public key content
git config --global user.signingkey "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAA... your_email@example.com"

Important notes:
- Use the public key file (ending in .pub), not the private key
- Git uses the public key to find the corresponding private key via ssh-agent
- The path can be absolute or relative to your home directory

Verify the key file exists:

bash
ls -la ~/.ssh/id_ed25519.pub
cat ~/.ssh/id_ed25519.pub
4Enable automatic commit signing (optional)

If you want all commits to be signed automatically without using the -S flag:

bash
# Sign all commits automatically
git config --global commit.gpgsign true

# Sign all tags automatically
git config --global tag.gpgsign true

With these settings, every git commit and git tag will be signed using your SSH key.

To sign a single commit manually:

bash
git commit -S -m "Your commit message"
5Ensure ssh-agent is running with your key

SSH signing requires your private key to be loaded in the ssh-agent:

bash
# Start the SSH agent
eval "$(ssh-agent -s)"

# Add your private key
ssh-add ~/.ssh/id_ed25519

# Verify the key is loaded
ssh-add -l

On macOS, persist the key across restarts:

bash
# Add to keychain
ssh-add --apple-use-keychain ~/.ssh/id_ed25519

Create or update ~/.ssh/config for automatic key loading:

bash
Host *
  AddKeysToAgent yes
  UseKeychain yes
  IdentityFile ~/.ssh/id_ed25519
6Test signing a commit

Verify that signing works correctly:

bash
# Make a test commit
echo "test" >> test.txt
git add test.txt
git commit -S -m "Test signed commit"

Verify the signature:

bash
# Show commit with signature
git log --show-signature -1

If successful, you'll see output indicating the commit was signed. If you get an error, check that your ssh-agent has the key loaded.

7Configure allowed signers for verification (optional)

To verify SSH signatures locally, set up an allowed signers file:

bash
# Create the allowed signers file
mkdir -p ~/.config/git
touch ~/.config/git/allowed_signers

# Configure Git to use it
git config --global gpg.ssh.allowedSignersFile ~/.config/git/allowed_signers

Add your public key to the allowed signers file:

bash
# Format: email-address key-type public-key
echo "your_email@example.com $(cat ~/.ssh/id_ed25519.pub)" >> ~/.config/git/allowed_signers

This enables Git to verify signatures from yourself and others whose keys you add to the file.

8Add your signing key to GitHub/GitLab

For commits to show as "Verified" on GitHub or GitLab, add your SSH key as a signing key:

GitHub:
1. Go to https://github.com/settings/keys
2. Click "New SSH key"
3. Select Key type: Signing Key (not Authentication)
4. Paste your public key
5. Click "Add SSH key"

Note: You can use the same SSH key for both authentication and signing, but you must add it twice - once as an Authentication key and once as a Signing key.

GitLab:
1. Go to https://gitlab.com/-/profile/keys
2. Paste your public key
3. Under "Usage type", select "Signing" or "Authentication and signing"
4. Click "Add key"

Bitbucket:
Bitbucket doesn't currently support SSH commit signing verification, but commits will still be signed locally.

9Clear conflicting local configuration

If you're still getting errors, there might be conflicting local settings:

bash
# Check for local overrides
git config --local --list | grep -E "(gpg|signing)"

# Remove local signing settings to use global ones
git config --local --unset gpg.format
git config --local --unset user.signingkey
git config --local --unset commit.gpgsign

# Verify global settings apply
git config --get gpg.format
git config --get user.signingkey

If switching from GPG to SSH signing:

bash
# Remove GPG-specific settings
git config --global --unset gpg.program

Advanced notes

### Requirements for SSH Signing

SSH commit signing requires:
- Git 2.34.0 or later (released November 2021)
- OpenSSH 8.1 or later (avoid OpenSSH 8.7 which has a signing bug - use 8.8+)

Check your versions:

bash
git --version
ssh -V

### SSH vs GPG Signing Comparison

| Aspect | SSH Signing | GPG Signing |
|--------|-------------|-------------|
| Key management | Use existing SSH keys | Separate GPG keyring |
| Setup complexity | Simpler | More complex |
| Key expiration | No built-in expiration | Supports expiration |
| Web of trust | Not supported | Supported |
| Platform support | Git 2.34+ | All Git versions |

### Complete Configuration Example

Here's a complete setup for SSH signing:

bash
# Set up SSH signing
git config --global gpg.format ssh
git config --global user.signingkey ~/.ssh/id_ed25519.pub
git config --global commit.gpgsign true
git config --global tag.gpgsign true

# Set up signature verification
git config --global gpg.ssh.allowedSignersFile ~/.config/git/allowed_signers
mkdir -p ~/.config/git
echo "$(git config user.email) $(cat ~/.ssh/id_ed25519.pub)" >> ~/.config/git/allowed_signers

### Signing with a Specific Key

If you have multiple SSH keys and want to use a specific one:

bash
# Use absolute path to avoid ambiguity
git config --global user.signingkey /home/username/.ssh/id_ed25519_signing.pub

### Using SSH Signing in CI/CD

For CI/CD pipelines, ensure the signing key is available:

yaml
# GitHub Actions example
- name: Configure Git signing
  run: |
    git config --global gpg.format ssh
    git config --global user.signingkey ~/.ssh/id_ed25519.pub
    eval "$(ssh-agent -s)"
    ssh-add ~/.ssh/id_ed25519

### Reverting to GPG Signing

To switch back from SSH to GPG signing:

bash
git config --global --unset gpg.format
# or explicitly set GPG
git config --global gpg.format openpgp
git config --global user.signingkey YOUR_GPG_KEY_ID
git config --global gpg.program gpg

### Troubleshooting

"error: Load key ... invalid format"
- Make sure you're pointing to the public key (.pub), not the private key
- Verify the key file isn't corrupted

Signature shows as "Unverified" on GitHub
- Ensure you added the key as a "Signing Key" (not just "Authentication Key")
- Verify the email in your commit matches the email on your GitHub account

"error: unable to sign data"
- Check ssh-agent is running: ssh-add -l
- Add your key: ssh-add ~/.ssh/id_ed25519

Frequently asked questions

What does "error: ssh signing is not configured. Set user.signingkey and gpg.form" mean?
This error indicates that Git is attempting to use SSH for signing commits or tags, but the necessary configuration is missing. 34 and later supports signing commits with SSH keys as an alternative to GPG keys. gpgsign enabled, Git tries to sign the commit.
How do I fix "error: ssh signing is not configured. Set user.signingkey and gpg.form"?
This error occurs when you try to sign a Git commit or tag with SSH but haven't configured the required signing settings. The fix involves setting gpg.format to ssh and specifying your SSH public key as user.signingkey.
What causes "error: ssh signing is not configured. Set user.signingkey and gpg.form"?
gpg.format is set to ssh but user.signingkey is not configured user.signingkey is set but gpg.format is not set to ssh SSH public key path in user.signingkey is incorrect or file doesn't exist
Is the "error: ssh signing is not configured. Set user.signingkey and gpg.form" error serious?
It is a low-severity error โ€” more of a blocker than a risk. The steps above resolve it.

Official resources & further reading