A couple of months ago I noticed that commits I’ve done through the GitHub web interface were receiving a “Verified” badge while commits done through the Git command line in WSL (Windows Subsystem for Linux) at my local dev machine weren’t.
I’m all for badges so I followed the steps found at About commit signature verification to setup GPG signing. The thing is, there was something still missing and as a result, when trying to commit I was getting an error message as follows:
error: gpg failed to sign the data
fatal: failed to write commit object
Fortunately, the solution is simple. Export a variable named GPG_TTY as follows:
export GPG_TTY=$(tty)
I ended appending it to ~/.bashrc so as to persist it between terminal sessions.