Gpg: skipped "MYSECRETKEY1234": No secret key on WIN 11

I have recently generated and setup a gpg key for which,

git config user.signingkey
17FE7178DD4F****
git config user.name
Subodh Pathak
git config user.email
subodhpathak1511@gmail.com

also I have setup the gpg location to C:\Program Files (x86)\GnuPG\bin\gpg.exe by this command git config --global gpg.program "C:\Program Files (x86)\GnuPG\bin\gpg.exe"

but on a commit message, I am getting error-

git commit -m "new version"
gpg: skipped "17FE7178DD4F****": No secret key
gpg: signing failed: No secret key
error: gpg failed to sign the data
fatal: failed to write commit object

also on

gpg --list-secret-keys --keyid-format LONG
sec rsa4096/17FE7178DD4F**** 2024-09-13 [SC] [expires: 2026-09-13]
    18B968642A3C3695E3AC4A5117FE7178DD4F****
uid [ultimate] Subodh Pathak subodhpathak1511@gmail.com
ssb rsa4096/0EE875A14DDF#### 2024-09-13 [E] [expires: 2025-09-13]

I ran all the processes from this documentation - Generating a new GPG key - GitHub Docs

I tried running git commit -m "new version"

and I was expecting it to commit the changes made

Hi @subodhpathak51,

which version of Gpg4win and which of Git are you using?

And which shell did you use for gpg and git? I just tried git on Windows 10 the first time and it comes with its own shell Mingw64. When I used it and called gpg --list-secret-keys it first had to initialize a directory and file to save the OpenPGP-keys so it didn’t access the same keys as gpg when I call it from e.g. the PowerShell.

@cklassen thanks for your time and kind reply,
So my current version of Gpg4win is 4.3.1 and I use git bash

Shall I use another terminal? If so, do I need to repeat all the process of generating the as mentioned in the documentation earlier provided?

Hi @cklassen got is solved, I used Powershell as cli for this rather than git bash
also with adminstrators permission.

If someone from future is seeing this thred kindly do as suggested.

Thanks
Subodh

1 Like