git commit signing failed: secret key not available

前端 未结 9 1609
臣服心动
臣服心动 2020-12-07 12:41

I am getting this error when trying to commit using Git.

gpg: skipped \"name \": secret key not available
gpg: signing failed: secret ke         


        
9条回答
  •  长情又很酷
    2020-12-07 13:45

    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 was creating the gpg keys using the git (configured path) version of GPG
    • Git was configured to use the downloaded version of gpg for the commit.
    • Seems GPG implementations use their own certificate database and storage.

    I hope this can help anyone that stumbles on this message and previous answers do not solve ther issue.

提交回复
热议问题