git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [Bug Report] Git does not push signingkey ID to GPG

From
Jeff King <peff@peff.net>
Date
Jul 23, 2021, 07:07 UTC
Message-ID
<YPpqlnuGrk8Gunep@coredump.intra.peff.net>
In-Reply-To
<dfeebef5-6f48-082d-f49d-832863ff62a8@oliverniebuhr.de>
On Fri, Jul 23, 2021 at 01:42:20AM +0200, Oliver Niebuhr wrote:
Show 24 quoted lines
> I have edit the .gitconfig File accordingly and added
> 
> [user]
> signingkey = NNN
> [commit]
> gpgsign = true
> [alias]
> amend = commit -S -s --amend
> cm = commit -S -s
> commit = commit -S -s
> tag = tag -S -s
> [gpg]
> program = C:\\Program Files (x86)\\GnuPG\\bin\\gpg.exe
> 
> The Git User Name and eMail Address are the same which are set in the used
> GPG Certificate.
> 
> Using '-S' from the Windows CMD Shell and Git Bash leads to an error.
> Neither typing the command manually or using it through an alias works.
> 
> When I switch '-S' with '--gpg-sign=NNN' everything works as it should from
> CMD Line - but not when I use for example SmartGit and enable 'Sign all
> Commits'. After countless hours looking through the Web, I am not out of
> Ideas.
This works fine for me. I get:
  $ GIT_TRACE=1 git -c user.signingkey=1234abcd commit -S --amend --no-edit
  03:03:26.487264 [pid=1285432] git.c:455           trace: built-in: git commit -S --amend --no-edit
  03:03:26.491963 [pid=1285432] run-command.c:666   trace: run_command: gpg --status-fd=2 -bsau 1234abcd
  error: gpg failed to sign the data
  fatal: failed to write commit object
In your trace, the key parameter that's passed is the empty string:
> 00:30:45.064284 run-command.c:667       trace: run_command: 'C:\Program
> Files (x86)\GnuPG\bin\gpg.exe' -bsau ''
> gpg: skipped "": Invalid user ID
> gpg: signing failed: Invalid user ID

You showed config with user.signingkey set. Is it possible that you have other config (say, in the repo config file), that is taking precedence?

What does:
  git config --show-origin --get-all user.signingkey
say when run inside the repository?
-Peff
Previous: Oliver Niebuhr
Message 2 of 2 in “[Bug Report] Git does not push signingkey ID to GPG”
  1. Oliver NiebuhrJul 22, 2021
  2. Jeff KingJul 23, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.