Last active
March 3, 2020 03:43
-
-
Save memtech3/b120d095b402593ebc19df3597deccd6 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
echo "enter gpg key ID" | |
echo "(found on line starting with sec, after slash /)" | |
echo "" | |
gpg --list-secret-keys --keyid-format LONG | |
read gpgKeyID | |
echo "adding key to git --global user.signingkey" | |
git config --global user.signingkey $gpgKeyID | |
echo "adding key to profile" | |
test -r ~/.bash_profile && echo 'export GPG_TTY=$(tty)' >> ~/.bash_profile | |
echo 'export GPG_TTY=$(tty)' >> ~/.profile | |
git config --global commit.gpgsign true | |
echo "copy the public key text into the github add gpg key textbox" | |
read -p "Press enter to view public key" | |
gpg --armor --export $gpgKeyID | |
echo "restart your computer when you finish for changes to take effect" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A small bash script to automate the process of adding an existing gpg key to git so that you can sign your commits