Last active
September 26, 2022 23:32
-
-
Save wes-goulet/59e1a9961f8b42613fd9d06f5e651204 to your computer and use it in GitHub Desktop.
Commands to import and setup your gpg key for git commit signing
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
# install gpg | |
brew install gnupg | |
# copy my-gpg-key.asc from other workstation or lastpass or somewhere | |
# and then import it | |
gpg --import ~/Downloads/my-gpg-key.asc | |
# make sure it's there and get the key id (the part that comes after "rsa4096/") | |
gpg --list-secret-keys --keyid-format LONG | |
gpg --edit-key <key ID> | |
# then use the "trust" command to give your key ultimate trust - CTRL-D to exit gpg | |
# now tell git to use your key | |
git config --global user.signingkey <key ID> | |
git config --global commit.gpgsign true | |
git config --global push.gpgsign if-asked | |
git config --global gpg.program $(which gpg) |
If you are not using bash try adding the above lines to your ~/.zshrc
then run source ~/.zshrc
I also feel that VPN and TMP Auth are required?
Also, the following block saved me multiple times:
if [ -r ~/.bash_profile ]; then echo 'export GPG_TTY=$(tty)' >> ~/.bash_profile; \ else echo 'export GPG_TTY=$(tty)' >> ~/.profile; fi
To export the GPG public key use the following command:
gpg --armor --export <key ID>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
you also need to add the following to your
.bash_profile