sudo apt-get install gnupg
gpg --full-generate-key
gpg --armor --export [email-id/key] > gpg.key
cat gpg.key
$ git config --global user.signingkey [secret-key]
$ git config --global commit.gpgsign true
$ git config --global gpg.program $(which gpg)
$ gpg --list-secret-keys --keyid-format=long
After then choose the secret key formatted as rsa.../secret key
git commit -S -m "msg"