# github gpg failed to sign the data

git gpg commit sign error:
gpg failed to sign the data
fatal: failed to write commit object

If you want to export your Key to GitHub then:
gpg --armor --export F9F78B768Fxxxxxand add this key to GitHub at GPG keys: https://github.com/settings/keys (with START and END line included)

If the issue still exists:

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):

When you create and add a key to gpg-agent you define something called passphrase. Now that passphrase at some point expires, and gpg needs you to enter it again to unlock your key so that you can start signing again.

When you use any other program that interfaces with gpg, gpg’s prompt to you to enter your passphrase does not appear (basically gpg-agent when daemonized cannot possibly show you the input dialog in stdin).

One of the solutions is gpg --sign a_file.txt (this is very import!!!) then enter the passphrase that you have entered when you created your key and then everything should be fine (gpg-agent should automatically sign)

See this answer on how to set longer timeouts for your passphrase so that you do not have to do this all the time.

Or you can completely remove the passphrase with ssh-keygen -p

Edit: Do a man gpg-agent to read some stuff on how to have the above happen automatically and add the lines:

GPG_TTY=\$(tty)
export GPG_TTY
on your .bashrc if you are using bash(this is the correct answer but I am keeping my train of thought above as well)

my environment

reference:
reference

:D 一言句子获取中...