I followed few articles over the pretty attributes on Git 2.10 release note. Going through which upgraded the git to 2.10.0 and made changes to global .gitconfig
resulting as follows -
[filter "lfs"]
clean = git-lfs clean %f
smudge = git-lfs smudge %f
required = true
[user]
name = xyz
email = abc.def@gmail.com
signingkey = AAAAAAA
[core]
excludesfile = /Users/xyz/.gitignore_global
editor = 'subl' --wait
[difftool "sourcetree"]
cmd = opendiff \"$LOCAL\" \"$REMOTE\"
path =
[mergetool "sourcetree"]
cmd = /Applications/SourceTree.app/Contents/Resources/opendiff-w.sh \"$LOCAL\" \"$REMOTE\" -ancestor \"$BASE\" -merge \"$MERGED\"
trustExitCode = true
[alias]
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
[color "diff"]
old = red strike
new = green italic
But now that I try to sign my commits using
git commit -a -S -m "message"
I get to see the following error -
You need a passphrase to unlock the secret key for
user: "XYZ (Digitally Signed) "
2048-bit RSA key, ID AAAAAAAA, created 2016-07-01
error: gpg failed to sign the data fatal: failed to write commit object
Note - I can still commit changes using git commit -a -m "message"
Is there a way to overcome the same? Or any change required in gpg
configs to get along with the upgradation of git?
Update 1
Also seeking further usefulness, following Is there a way to "autosign" commits in Git with a GPG key?. I've already configured the key using
git config --global user.signingkey ED5CDE14(with my key)
git config --global commit.gpgsign true
and quite obviously getting the same error anyway.
Very much like @birchlabs, after a lot of digging/searching I found that it wasn't GPG, but rather GPG Suite. I did
cask reinstall gpg-suite
and it solved it for me.I've DONE it through this short and easy recipe:
Auto-sign commits on MacOS (Globally and with different IDEs):
Get your
signingkey
in this way.Put the following in
gpg.conf
file (edit file withnano ~/.gnupg/gpg.conf
command):Put the following in
gpg-agent.conf
file (edit file withnano ~/.gnupg/gpg-agent.conf
command):got it setup by simply :
Update Oct. 2016: issue 871 did mention "Signing stopped working in Git 2.9.3"
Git for Windows 2.10.1 released two days ago (Oct. 4th, 2016) has fixed Interactive GPG signing of commits and tag.
Original answer:
Reading "7.4 Git Tools - Signing Your Work", I assume you have your "
user.signingkey
" configuration set.The last big refactoring (before Git 2.10) around gpg was in commit 2f47eae2a, here that error message was moved to
gpg-interface.c
A log on that file reveals the recent change in commit af2b21e (Git 2.10)
So check how you specified your
user.signingkey
configuration, and the version of gpg you are using (gpg1 or gpg2), to see if those have any effect on the error message.There is also commit 0581b54 which changes the condition for the
gpg failed to sign the data
error message (in complement to commit 0d2b664):Commit 4322353 shows gpg now uses a temporary file, so there could be right issues around that.
The git trace was very revealing for my situation...
I needed to generate an initial key per the format that git was checking against.
Then it worked.
And be sure to replace your name and email instead of
"First Last <first.last@domain.com>"
Hope that helps.
I must have accidentally updated gpg somehow because I got this after trying to test if gpg works:
Running
gpgconf --kill all
fixed it for me.Hope this helps someone.