I follow this tutorial: https://help.github.com/articles/signing-commits-using-gpg/
I try to sign when commit like this: https://github.com/spring-guides/tut-spring-boot-oauth2/commit/824f418ab9d04114b14a90f7c19b4b8d6dda67b7
but error:
C:\Users\Administrator\Desktop\foo\test_gpg>git commit -m "test"
gpg: skipped "DABDD34E": secret key not available
gpg: signing failed: secret key not available
error: gpg failed to sign the data
fatal: failed to write commit object
My config:
C:\Users\Administrator\Desktop\foo\test_gpg>git config --list --show-origin
file:"C:\\ProgramData/Git/config" core.symlinks=false
file:"C:\\ProgramData/Git/config" core.autocrlf=true
file:"C:\\ProgramData/Git/config" core.fscache=true
file:"C:\\ProgramData/Git/config" color.diff=auto
file:"C:\\ProgramData/Git/config" color.status=auto
file:"C:\\ProgramData/Git/config" color.branch=auto
file:"C:\\ProgramData/Git/config" color.interactive=true
file:"C:\\ProgramData/Git/config" help.format=html
file:"C:\\ProgramData/Git/config" http.sslcainfo=C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt
file:"C:\\ProgramData/Git/config" diff.astextplain.textconv=astextplain
file:"C:\\ProgramData/Git/config" rebase.autosquash=true
file:"C:\\Program Files\\Git\\mingw64/etc/gitconfig" credential.helper=manager
file:C:/Users/Administrator/.gitconfig user.name=donhuvy
file:C:/Users/Administrator/.gitconfig [email protected]
file:C:/Users/Administrator/.gitconfig user.signingkey=DABDD34E
file:C:/Users/Administrator/.gitconfig commit.gpgsign=true
file:C:/Users/Administrator/.gitconfig use.signingkey=DABDD34E
file:.git/config core.repositoryformatversion=0
file:.git/config core.filemode=false
file:.git/config core.bare=false
file:.git/config core.logallrefupdates=true
file:.git/config core.symlinks=false
file:.git/config core.ignorecase=true
file:.git/config core.hidedotfiles=dotGitOnly
file:.git/config remote.origin.url=https://github.com/donhuvy/test_gpg.git
file:.git/config remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
file:.git/config branch.master.remote=origin
file:.git/config branch.master.merge=refs/heads/master
file:.git/config commit.gpgsign=true
and
C:\Users\Administrator\Desktop\foo\test_gpg>gpg --list-key
C:/Users/Administrator/AppData/Roaming/gnupg/pubring.gpg
--------------------------------------------------------
pub 2048R/DABDD34E 2016-06-10
uid [ultimate] donhuvy (Do Nhu Vy) <[email protected]>
uid [ultimate] Do Nhu Vy (Do Nhu Vy) <[email protected]>
sub 2048R/C6B535A2 2016-06-10
(I register 3 emails with GitHub: [email protected]
, [email protected]
and [email protected]
)
What I have been wrong? How I sign my commit?
I too had the same problem. Unfortunately the error message does not pinpoint the real issue....which is that you have not configured git to use the gpg program you are using, which I suspect is gpg4win.[I have encountered this only on a Win machine]
git config --global gpg.program "C:/Program Files (x86)/GNU/GnuPG/gpg2.exe"
Please run the above command followed by the below.
git config user.signingkey DABDD34E
You many need to restart the terminal ; and reissue your git commit
command.
Hope this helps.
I am using TortoiseGIT on Windows 10, and I was having the same problem right now.
For me this solved the problem:
git config --global gpg.program "c:\Program Files (x86)\GnuPG\bin\gpg.exe"
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