Skip to content

Instantly share code, notes, and snippets.

@w3dg
Forked from tuxfight3r/git-gpg-sign.txt
Created January 1, 2022 04:29
Show Gist options
  • Select an option

  • Save w3dg/a51104120b15f3112120070f9a55f0a5 to your computer and use it in GitHub Desktop.

Select an option

Save w3dg/a51104120b15f3112120070f9a55f0a5 to your computer and use it in GitHub Desktop.

Revisions

  1. @tuxfight3r tuxfight3r created this gist Feb 24, 2021.
    18 changes: 18 additions & 0 deletions git-gpg-sign.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@

    # generate a key if you don't have one already
    gpg --full-gen-key

    # list the keys in long format and copy the key id after sec rsa4096/<KEY>
    gpg --list-secret-keys --keyid-format LONG

    # export the public key and post into your git profile (ui)
    gpg --armor --export 127CAA89CEA6BE66

    # update the global git configs,
    git config --global user.signingkey 127CAA89CEA6BE66
    git config --global commit.gpgsign true

    # update your GPG_TTY
    echo 'export GPG_TTY=$(tty)' >> ~/.bash_profile

    #do a git commit and it should prompt you for your gpg password.