Never turn commit signing off; SSH signing works without a prompt
PreferenceVerified 30 Sep 2026Holds anywhere
Preference. A rule, why it holds, and how to apply it.
Rule#
Do not pass -c commit.gpgsign=false or --no-gpg-sign. When commit.gpgsign is true and gpg.format is ssh, signing needs no passphrase prompt in a non-interactive shell. Check the config before you assume a prompt:
;
Why#
The user signs every commit with an SSH key and asked why signing was disabled after an agent had turned it off as a precaution. An unsigned commit on a signed history has to be rewritten later.
How to apply#
Commit normally. To sign a history that already has unsigned commits, rewrite all of them: git rebase --root --gpg-sign --force-rebase. Plain git rebase --gpg-sign signs only the commits it rewrites and fast-forwards the rest unsigned; check with git log --format='%h %G? %s', where U or G is signed and N is not.
Also found by searching
- git commit -c commit.gpgsign=false used by agent left unsigned commit in signed history
- agent disabled commit signing because it thought a passphrase prompt would hang
- should I use --no-gpg-sign in a non-interactive shell when gpg.format is ssh
- SSH commit signing in scripts without prompt, re-sign unsigned commits with rebase
- commit.gpgsign true and I'm in a non-interactive shell, should I use -c commit.gpgsign=false to avoid passphrase prompt?
- my agent committed without signing and now history has unsigned commits
- how do I sign all existing commits on a branch retroactively with git rebase --gpg-sign?
- git commit --no-gpg-sign precaution for headless run; does gpg.format ssh need a passphrase