Skip to content

Instantly share code, notes, and snippets.

@ganapativs
Forked from mort3za/git-auto-sign-commits.sh
Created October 19, 2018 11:34
Show Gist options
  • Save ganapativs/4b3cb62dbf3d51edc3703f77a31732f4 to your computer and use it in GitHub Desktop.
Save ganapativs/4b3cb62dbf3d51edc3703f77a31732f4 to your computer and use it in GitHub Desktop.
Auto sign your git commits
# generate a new pgp key: (better to use gpg2 instead of gpg)
gpg --gen-key
# maybe you need some random work in your OS to generate a key. so run this command: `find ./* /home/username -type d | xargs grep some_random_string > /dev/null`
# check current keys:
gpg --list-secret-keys --keyid-format LONG
# export private key in gpg:
gpg --export-secret-key -a "your_username"
# export public key in gpg:
gpg --armor --export your_key_id
# your_key_id is the HASH id in front of `sec` in previous command.
# set a pgp key for git:
git config --global user.signingkey your_key_id
# sign your single commit:
git commit -S -a -m "Test a signed commit"
# auto sign your commits globaly
git config --global commit.gpgsign true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment