$ gpg --full-generate-key
$ gpg --list-secret-keys --keyid-format=long
$ gpg --armor --export GPG_KEY_ID # get key id from prev list command - see details in above linkCopy output of last command (gpg armor export). Go to Github > Settings > SSH and GPG Keys > New GPG Key and paste it.
NOTE: To avoid hassle, I kept passphrase blank.
$ cd /path/to/repo
$ git config commit.gpgsign true
$ git config user.signingkey GPG_SIGNING_KEY # signing key is the "subkeys" shown in github after adding gpg key
$ git commit -m 'message' # or to sign existing commit: git commit --amend