Create key. There are plenty of how-tos on internet
gpg --list-secret-keys --keyid-format LONG
gpg --armor --export <ID>
Add on github.com
git config --global commit.gpgsign true
git config --global user.signingkey <ID>
git config --global gpg.program <gpg|gpg2>
git config --global user.name "<name>"
git config --global user.email "<main e-mail address in GPG key>"
Add to shell profile:
alias gcsm="git commit -S -m"
with the below error:
error: gpg failed to sign the data
fatal: failed to write commit object
The first command you need to run:gpgconf --kill scdaemon