I'm getting this error when trying to sign a commit:
git commit -S -m "test"
gpg: skipped "EF617ACA9EC3XXXX": No secret key
gpg: signing failed: No secret key
error: gpg failed to sign the data
fatal: failed to write commit object
This is the output of gpg --list-secret-keys --keyid-format LONG
The key is present there
sec rsa4096/EF617ACA9EC3XXXX 2020-05-17 [SC] [expires: 2022-05-17]
AD68154000A712DCD161D826EF617ACA9EC3XXXX
uid [ultimate] name <[email protected]>
And this is git config with the same key
user.signingkey=EF617ACA9EC3XXXX
[email protected]
Any idea what's wrong?
You can sign commits locally using GPG, SSH, or S/MIME. Note: GitHub Desktop only supports commit signing if your Git client is configured to sign commits by default. Tips: To configure your Git client to sign commits by default for a local repository, in Git versions 2.0.
Signing, or code signing specifically, is the process of using cryptography to digitally add a signature to data. The receiver of the data can verify that the signature is authentic, and therefore must've come from the signatory. It's like physical signatures, but digital and more reliable.
If you have multiple keys or are attempting to sign commits or tags with a key that doesn't match your committer identity, you should tell Git about your signing key. If you're using GPG, after you create your commit, provide the passphrase you set up when you generated your GPG key. On GitHub, navigate to your pull request.
Note: GitHub Desktop does not support commit signing. To configure your Git client to sign commits by default for a local repository, in Git versions 2.0.0 and above, run git config commit.gpgsign true. To sign all commits by default in any local repository on your computer, run git config --global commit.gpgsign true.
From the list of GPG keys, copy the long form of the GPG key ID you'd like to use. In this example, the GPG key ID is 3AA5C34371567BD2: To set your primary GPG signing key in Git, paste the text below, substituting in the GPG primary key ID you'd like to use. In this example, the GPG key ID is 3AA5C34371567BD2:
Note: GitHub Desktop does not support commit signing. To configure your Git client to sign commits by default for a local repository, in Git versions 2.0.0 and above, run git config commit.gpgsign true.
git config --global gpg.program "c:/Program Files (x86)/GnuPG/bin/gpg.exe"
I installed with Kleopatra and generated my key within that. I was unable to create a commit until I ran the command above.
Check first the git config gpg.program
to see if this is gpg
or gpg2
(as in here).
And type where gpg
nd where gpg2
to check which path is considered for the GPG program.
I suggested to set gpg.program
to gpg2
, and copy your gpg.exe
(assuming its version is a 2.x) to gpg2.exe
That should force Git/GPG to act as gpg2.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With