diff options
| author | Junio C Hamano <gitster@pobox.com> | 2023-02-03 16:08:21 -0800 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2023-02-03 16:08:21 -0800 |
| commit | c7757b2781084ceb982ab9422011ff88e49180a0 (patch) | |
| tree | 3b12233fac4e4b9c9b3e88c5f3998e4151cbc09e | |
| parent | 86cca7593e737c2dbd9909dd1fdb8a9b5758aad2 (diff) | |
| parent | dce7b311266951fc2fb7a1dcbe89416ba8cebbb5 (diff) | |
Merge branch 'as/ssh-signing-improve-key-missing-error'
Improve the error message given when private key is not loaded in
the ssh agent in the codepath to sign with an ssh key.
* as/ssh-signing-improve-key-missing-error:
ssh signing: better error message when key not in agent
| -rw-r--r-- | gpg-interface.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/gpg-interface.c b/gpg-interface.c index f877a1ea56..687236430b 100644 --- a/gpg-interface.c +++ b/gpg-interface.c @@ -998,6 +998,7 @@ static int sign_buffer_ssh(struct strbuf *buffer, struct strbuf *signature, char *ssh_signing_key_file = NULL; struct strbuf ssh_signature_filename = STRBUF_INIT; const char *literal_key = NULL; + int literal_ssh_key = 0; if (!signing_key || signing_key[0] == '\0') return error( @@ -1005,6 +1006,7 @@ static int sign_buffer_ssh(struct strbuf *buffer, struct strbuf *signature, if (is_literal_ssh_key(signing_key, &literal_key)) { /* A literal ssh key */ + literal_ssh_key = 1; key_file = mks_tempfile_t(".git_signing_key_tmpXXXXXX"); if (!key_file) return error_errno( @@ -1039,8 +1041,10 @@ static int sign_buffer_ssh(struct strbuf *buffer, struct strbuf *signature, "-Y", "sign", "-n", "git", "-f", ssh_signing_key_file, - buffer_file->filename.buf, NULL); + if (literal_ssh_key) + strvec_push(&signer.args, "-U"); + strvec_push(&signer.args, buffer_file->filename.buf); sigchain_push(SIGPIPE, SIG_IGN); ret = pipe_command(&signer, NULL, 0, NULL, 0, &signer_stderr, 0); |
