I am getting this error when trying to commit using Git.
gpg: skipped \"name \": secret key not available
gpg: signing failed: secret ke
You have to set the variable GNUPGHOME.
Without it, GnuPG is not able to find your keys.
# On unix add it to your path
# On windows it will usually be under:
<drive>:\Users\<username>\AppData\Roaming\gnupg
On Unix it simply adding it to the path.
On Windows you have to open the control panel and set it as
System Variable
Name: GNUPGHOME
Path: <drive>:\Users\<username>\AppData\Roaming\gnupg
I had a situation in which the same was happening to me in a Windows 10 machine.
$ git commit -m "Improve logging, imports and show time executed"
gpg: signing failed: Operation cancelled
gpg: signing failed: Operation cancelled
error: gpg failed to sign the data
fatal: failed to write commit object
The commands "C:\Program Files (x86)\GnuPG\bin\gpg.exe" --list-secret-keys --keyid-format LONG and gpg --list-secret-keys --keyid-format LONG where giving me complete different results!
$ where gpg
C:\Program Files\Git\usr\bin\gpg.exe
C:\Program Files (x86)\GnuPG\bin\gpg.exe
The main reason was related to previous answers but on a different sense:
I hope this can help anyone that stumbles on this message and previous answers do not solve ther issue.
Maybe you need to clone your own repository where you have rights. I had this issue when I cloned the repository of another person.