Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save trilin6/e4c52942748169a7849969f3d0e2d45f to your computer and use it in GitHub Desktop.

Select an option

Save trilin6/e4c52942748169a7849969f3d0e2d45f to your computer and use it in GitHub Desktop.
GPG Guide - MacOS

GPG Installation and Key Management Guide for macOS πŸš€

This guide walks you through installing GPG on macOS, managing keys, creating a new ECC key with Curve25519, and integrating with GitHub for secure commit signing. Let’s dive in! πŸ’‘

1. Installing GPG on macOS πŸ› οΈ

Recommended Method βœ…

Install GPG using Homebrew:

brew install gnupg

Verify Installation πŸ”

Confirm GPG is installed:

gpg --version

Look for output like gpg (GnuPG) 2.2.x.


2. GUI Tools for Key Management on macOS πŸ–₯️

Manage your keys easily with these macOS tools:

  • GPA (Gnu Privacy Assistant)

    • Install: brew install gpa
    • Features: Simple key management and encryption
  • Keybase

    • Install: Download from keybase.io
    • Features: GPG key management with cloud integration

Pick the one that suits your needs! πŸ§ͺ


3. Listing Secret Keys πŸ”‘

View your secret keys with:

gpg --list-secret-keys --keyid-format=long

Example Output

sec   ed25519/1234567890ABCDEF 2025-05-17 [SC]
      Key fingerprint = ABCD 1234 5678 90AB CDEF 1234 5678 90AB CDEF 1234
uid               Your Name <[email protected]>

4. Creating a New ECC Key with Curve25519 πŸ†•

Generate a key using:

gpg --full-generate-key

Steps

  1. Choose (9) ECC and ECC.
  2. Select (1) Curve 25519.
  3. Set validity (e.g., 2y or 0 for no expiration).
  4. Enter your name, email, and an optional comment.
  5. Set a strong passphrase.

Curve25519 offers modern security and speed! 🌟


5. Integrating GPG with GitHub πŸ”—

Add Your GPG Key to GitHub

  1. Export your public key:
    gpg --armor --export <your-key-id>
  2. Copy it and add it to GitHub’s GPG settings.

Sign Commits with Git

  1. Set your signing key:
    git config --global user.signingkey <your-key-id>
  2. Enable signing:
    git config --global commit.gpgsign true

Your commits are now signed! πŸŽ‰


6. Resources πŸ“š

Explore these for more details.


Enjoy secure coding! πŸ”βœ¨

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