feat: per-identity signing format and SSH key#2
Merged
Conversation
Identities can now carry their signing format and SSH transport, so they follow the directory like name and email do. create/edit gain: - --format <openpgp|ssh|x509> (gpg.format; SSH signing needs git >= 2.34) - --ssh-key <path>, shorthand for core.sshCommand = ssh -i '<path>' -o IdentitiesOnly=yes (the named key is used; an agent key cannot shadow it) - --ssh-command <cmd>, stored verbatim (mutually exclusive with --ssh-key) - edit --no-format / --no-ssh to remove them Both values are validated against control characters and escaped at render time, so neither can inject a gitconfig section, and they are surfaced in show/list --json as user.format and user.ssh_command.
Add a "Signing and SSH keys" section to the README, note the new fragment keys in the layout, and record the feature under CHANGELOG [Unreleased]. Drop the now-implemented items from the Future work line.
doctor now inspects each identity's gpg.format: it warns when the value is not one of openpgp/ssh/x509 (a hand-edited fragment that git would only reject at signing time), and when gpg.format=ssh but the installed git is older than 2.34, which cannot sign with SSH.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Lets each identity carry its signing format and SSH transport, so they follow
the directory like
user.name/user.emailalready do. Closes the two"future work" items: GPG/SSH signing helpers and per-identity SSH keys.
New flags (
create/edit)--format <openpgp|ssh|x509>→gpg.format(SSH commit signing needs git ≥ 2.34)--ssh-key <path>→ shorthand forcore.sshCommand = ssh -i '<path>' -o IdentitiesOnly=yes,so the named key is used and an agent key can't shadow it. The path is
shell-quoted (git runs
core.sshCommandthrough a shell).--ssh-command <cmd>→ storescore.sshCommandverbatim (mutually exclusivewith
--ssh-key)edit:--no-format/--no-sshremove themThe two values are exposed in
show/list --jsonasuser.formatanduser.ssh_command.Safety
Both new fields go through
validate_*(control characters rejected) andquote_cfg_valueat render time, so neither can inject a gitconfig section —same guarantee as
--signing-key. Hand-added keys in a fragment are stillpreserved by
edit.doctor
doctornow flags an identity whosegpg.formatisn't one of openpgp/ssh/x509(a hand-edited fragment git would only reject at signing time), and warns when
gpg.format = sshbut the installed git is older than 2.34.Tests
cargo testgreen (55 unit + 54 integration). New coverage: fragment renderingof the
[gpg]/[core]sections, shell-quoting of the key path, formatvalidation, flag exclusivity, control-char rejection,
editset/remove, andthe doctor format check.
clippy -D warningsandfmt --checkclean.Verified end-to-end in a throwaway HOME that git resolves
gpg.formatandcore.sshCommandthrough the conditional include from inside a routed repo.🤖 Generated with Claude Code