-
-
Save paolocarrasco/ab6244b16c942514db18962a24b257fe 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 in all below commands) | |
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 | |
# Set a gpg key for git (from previous step... the key_id is after the slash): | |
git config --global user.signingkey your_key_id | |
# To sign a single commit: | |
git commit -S -a -m "Test a signed commit" | |
# Auto-sign all commits globaly | |
git config --global commit.gpgsign true | |
# Also it's better to use gpg2 instead of gpg in above commands. In this case, you should set gpg2 as default program for gpg in git, To do this: | |
git config --global gpg.program gpg2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Don't forget to
gpg --armor --export YOUR_KEY_ID
and pass the public key block to whoever needs to verify your signature