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
The answers above are great but they did not work for me. What solved my issue was exporting both the public and secret keys.
list the keys from machine where we are exporting from
$ gpg --list-keys
/home/user/.gnupg/pubring.gpg
--------------------------------
pub 1024D/ABCDFE01 2008-04-13
uid firstname lastname (description) <email@example.com>
sub 2048g/DEFABC01 2008-04-13
export the keys
$ gpg --output mygpgkey_pub.gpg --armor --export ABCDFE01
$ gpg --output mygpgkey_sec.gpg --armor --export-secret-key ABCDFE01
go to machine we are importing to and import
$ gpg --import ~/mygpgkey_pub.gpg
$ gpg --allow-secret-key-import --import ~/mygpgkey_sec.gpg
bingo bongo, you're done!
reference: https://www.debuntu.org/how-to-importexport-gpg-key-pair/
ps. My keys were originally made on bootcamp windows 7 and I exported them onto my mac air (same physical machine, different virtually)
I stumbled upon this error not because of any configuration issue, but because my key was expired. The easiest way to extend its validity on OSX is to open the GPG Keychain app (if you have it installed) and it will automatically prompt you to extend it. Two clicks, and you're done. Hopefully this helps fellow Googlers :)
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.
the recent gpg-sign change in git (which introduces no problem on Linux) exposes a problem in the way in which, on Windows, non-MSYS2-git interacts with MSYS2-gpg.
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)
gpg2 already uses the long format by default, but most distributions seem to still have "gpg" be the older 1.x version due to compatibility reasons. And older versions of gpg only show the 32-bit short ID, which is quite insecure.
This doesn't actually matter for the verification itself: if the verification passes, the pgp signature is good.
But if you don't actually have the key yet, and want to fetch it, or you want to check exactly which key was used for verification and want to check it, we should specify the key with more precision.
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):
We don't read from stderr at all currently. However, we will want to in a future patch, so this also prepares us there (and in that case gpg does write before reading all of the input, though again, it is unlikely that a key uid will fill up a pipe buffer).
Commit 4322353 shows gpg now uses a temporary file, so there could be right issues around that.
Let's convert to using a tempfile object, which handles the hard cases for us, and add the missing cleanup call.
got it setup by simply :
brew uninstall gpg
brew install gpg2
To anybody who is facing this issue on MacOS machines, try this:
brew uninstall gpg
brew install gpg2
brew install pinentry-mac
(if needed)gpg --full-generate-key
Create a key by using an algorithm.gpg --list-keys
git config --global user.signingkey <Key from your list>
git config --global gpg.program /usr/local/bin/gpg
git config --global commit.gpgsign true
gpg --armor --export <key>
and add this key to GitHub at GPG keys: https://github.com/settings/keys (with START and END line included)If the issue still exists:
test -r ~/.bash_profile && echo 'export GPG_TTY=$(tty)' >> ~/.bash_profile
echo 'export GPG_TTY=$(tty)' >> ~/.profile
If the issue still exists:
Install https://gpgtools.org and sign the key that you used by pressing Sign from the menu bar: Key->Sign
If the issue still exists:
Go to: your global .gitconfig
file which in my case is at: /Users/gent/.gitconfig
And modify the .gitconfig file (please make sure Email and Name are the same with the one that you have created while generating the Key):
[user]
email = gent@youremail.com
name = Gent
signingkey = <YOURKEY>
[gpg]
program = /usr/local/bin/gpg
[commit]
gpsign = true
gpgsign = true
[filter "lfs"]
process = git-lfs filter-process
required = true
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
[credential]
helper = osxkeychain
If this just happened randomly and has been working perfectly in the past, as is my case, try logging out (cmd+shift+q
) and logging back in. Worked for me