Created
April 3, 2019 11:13
-
-
Save kylejeske/45df7ddab8e370464484696350a95f02 to your computer and use it in GitHub Desktop.
Quick and easy: grab your GPG key
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
#!/bin/bash | |
printf "%s\n%s\n" "Note: This program assumes there is only 1 key (sec) assigned to a GPG Public key. If there is a secondary (ssb) assigned, this program WILL NOT work." | |
# Signing Commits and Assigning GPG Key to GitHub Account | |
# https://help.github.com/en/articles/signing-commits | |
# https://help.github.com/en/articles/associating-an-email-with-your-gpg-key | |
$(gpg --update-trustdb 2> 1) | |
# Fetch list-secret-keys & public key | |
gpgkey=$(gpg --list-secret-keys --keyid-format LONG | awk 'NR==3' | cut -b 15-30) | |
gpgpub=$(gpg --armor --export $gpgkey) | |
# Print it to the screen | |
printf "Your GPG Key is: %s\n" $gpgkey | |
# Export Public GPG Key, Output it to the screen at the same time store it to local .gpg folder as pubkey.pgpkey | |
echo "$gpgpub" | tee -i -p --output-error=exit-nopipe .secring.pgpkey 2> 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment