Skip to content

Instantly share code, notes, and snippets.

@indraAsLesmana
Forked from cdalvaro/gpg-with-key
Last active December 26, 2024 14:26
Show Gist options
  • Save indraAsLesmana/d96f3f2cbee074d0e0acec4124a2f3b2 to your computer and use it in GitHub Desktop.
Save indraAsLesmana/d96f3f2cbee074d0e0acec4124a2f3b2 to your computer and use it in GitHub Desktop.
Setting up GPG signature on macOS Sonoma for IDE IntelliJ and XCode
# Install gpg tools
https://gpgtools.org
# 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
# Importing
gpg --armor --import ~/.backups/gpg_git_private.key
gpg --list-secret-keys --keyid-format LONG <EMAIL>
# Copy ed25519/<ID> or rsa/<ID> (in the `sec` section)
git config --global user.signingkey <ID>
git config --global commit.gpgsign true
# Copy public key register to gitlab/github (start from -----BEGIN till BLOCK-----)
# When copy to clipboard switch to gpgtools app it will detect key and suggest you to save. just saveit.
gpg --armor --export <ID>
# Set the gpg program used by git
git config --global gpg.program "/usr/local/MacGPG2/bin/gpg"
# Open project folder in terminal run this command to show prompt input pharase in first run
echo "prompt pharase first" | gpg --clearsign
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment