git rev-list fails to verify ssh-signed commits (but git log works)
- From
- Max Gautier <max.gautier@redhat.com>
- Date
- Feb 8, 2023, 15:56 UTC
- Message-ID
- <Y+PGRaiTTaZ/DtlJ@work-laptop-max>
Hi.
I was trying to implement a pre-push hook to verify my commits are properly signed before pushing them, and stumbled upon the following output (which looks like a bug to me):
$ git rev-list @{u}..HEAD --format='%G? %H' commit 9497d347b048dbea7f527624f815f7926594c4bc error: gpg.ssh.allowedSignersFile needs to be configured and exist for ssh signature verification N 9497d347b048dbea7f527624f815f7926594c4bc commit 2466c5b3c0f2053b3cdadf4af299aab35e74aa0c error: gpg.ssh.allowedSignersFile needs to be configured and exist for ssh signature verification N 2466c5b3c0f2053b3cdadf4af299aab35e74aa0c commit ded83bc7f31df14b2e9a8d7bdfa1e95eee2bf5c1 error: gpg.ssh.allowedSignersFile needs to be configured and exist for ssh signature verification N ded83bc7f31df14b2e9a8d7bdfa1e95eee2bf5c1 commit 16d17277c608d995ad4d0b495d029c753509930c error: gpg.ssh.allowedSignersFile needs to be configured and exist for ssh signature verification N 16d17277c608d995ad4d0b495d029c753509930c
While git log works and is able to retrieve the signatures
$ git log @{u}..HEAD --format='%G? %H' G 9497d347b048dbea7f527624f815f7926594c4bc G 2466c5b3c0f2053b3cdadf4af299aab35e74aa0c G ded83bc7f31df14b2e9a8d7bdfa1e95eee2bf5c1 G 16d17277c608d995ad4d0b495d029c753509930c
I get the error even though I have the following config : $ git config --list | grep 'allowed' gpg.ssh.allowedsignersfile=~/.config/git/MY_SIGNER_KEYS # by the way the actual config entry in ~/.config/git/config is # #[gpg "ssh"] # allowedSignersFile = ~/.config/git/MY_SIGNER_KEYS
$ cat ~/.config/git/MY_SIGNER_KEYS mg@max.gautier.name,max.gautier@redhat.com sk-ssh-ed25519@openssh.com AAAAGnNrLXNzaC1lZDI1NTE5QG9wZW5zc2guY29tAAAAIL3W2Y4eAF92ySEW6ZE7d8Q+GXvP2G5quvN0zM+f1jGUAAAAB3NzaDphbGw= mg@max.gautier.name,max.gautier@redhat.com sk-ssh-ed25519@openssh.com AAAAGnNrLXNzaC1lZDI1NTE5QG9wZW5zc2guY29tAAAAIGBP0XfpNXRoFBIW9uEgfnCrrjgvzxr0taOYy0A03DtKAAAABHNzaDo=
Am I missing something obvious ? Or is it git rev-list running in such a context than it can't find the allowedSignersFile ?
Thanks
-- Max Gautier Software Engineer, Open Services Group, Emerging Technologies Red Hat max.gautier@redhat.com