-
-
Save ganapativs/4b3cb62dbf3d51edc3703f77a31732f4 to your computer and use it in GitHub Desktop.
Auto sign your git commits
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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