Skip to content

Instantly share code, notes, and snippets.

@memtech3
Last active March 3, 2020 03:43
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save memtech3/b120d095b402593ebc19df3597deccd6 to your computer and use it in GitHub Desktop.
Save memtech3/b120d095b402593ebc19df3597deccd6 to your computer and use it in GitHub Desktop.
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"
@memtech3
Copy link
Author

memtech3 commented Mar 2, 2020

A small bash script to automate the process of adding an existing gpg key to git so that you can sign your commits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment