-
-
Save cdalvaro/f136792780e4306887daed3d9a64e972 to your computer and use it in GitHub Desktop.
Setting up GPG signature on macOS with Xcode
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
/usr/local/bin/gpg --batch --pinentry-mode=loopback --passphrase-file ~/.gnupg/key.txt --no-tty "$@" |
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
# Install gpg | |
brew install gpg | |
# Generating and exporting | |
gpg --gen-key | |
gpg --armor --export <email> > ~/.backups/gpg_git_public.key | |
gpg --armor --export-secret-key <email> > ~/.backups/gpg_git_private.key | |
chmod 600 ~/.backups/gpg_git_public.key | |
chomd 600 ~/.backups/gpg_git_private.key | |
# Importing | |
gpg --armor --import ~/.backups/gpg_git_private.key | |
gpg --list-secret-keys | |
# Copy the 8-digit id of the key (in the `sec` section) | |
git config --global user.signingkey <8-digit key id> | |
git config --global commit.gpgsign true | |
# Put the passpharse for the GPG key to the first line of the file | |
vi ~/.gnupg/key.txt | |
chmod 600 ~/.gnupg/key.txt | |
# Add lines from the gpg-with-key file of this gist | |
vi /usr/local/bin/gpg-with-key | |
chmod 755 /usr/local/bin/gpg-with-key | |
# Set the gpg program used by git | |
git config --global gpg.program "/usr/local/bin/gpg-with-key" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment