Skip to content

Instantly share code, notes, and snippets.

@sindresorhus
Forked from bmhatfield/.profile
Created April 6, 2016 11:10
Show Gist options
  • Save sindresorhus/98add7be608fad6b5376a895e5a59972 to your computer and use it in GitHub Desktop.
Save sindresorhus/98add7be608fad6b5376a895e5a59972 to your computer and use it in GitHub Desktop.

Revisions

  1. @bmhatfield bmhatfield revised this gist Apr 6, 2016. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions setup-gpg
    Original file line number Diff line number Diff line change
    @@ -18,6 +18,8 @@ git config --global commit.gpgsign true

    # Don't forget to upload your public key to Github!
    # https://github.com/blog/2144-gpg-signature-verification
    # Note: There needs to be a three-way match on your email for Github to show
    # the commit as 'verified': The commit email, github email, & the email associated with the public key

    # Learn about creating a GPG key and the knowledge behind these commands here:
    # https://git-scm.com/book/en/v2/Git-Tools-Signing-Your-Work
  2. @bmhatfield bmhatfield revised this gist Apr 6, 2016. 1 changed file with 7 additions and 0 deletions.
    7 changes: 7 additions & 0 deletions setup-gpg
    Original file line number Diff line number Diff line change
    @@ -9,6 +9,13 @@ brew install gnupg gpg-agent pinentry-mac
    git config --global user.signingkey <YOUR-SIGNING-KEY-PUB-ID>
    git config --global commit.gpgsign true

    # 3) Configure the GPG components (see above for relevant examples):
    # ~/.gnupg/gpg.conf
    # ~/.gnupg/gpg-agent.conf

    # 4) Start the daemon and configure your shell (see above for example in .profile).
    # ~/.bash_profile | ~/.zshrc

    # Don't forget to upload your public key to Github!
    # https://github.com/blog/2144-gpg-signature-verification

  3. @bmhatfield bmhatfield revised this gist Apr 6, 2016. 6 changed files with 31 additions and 17 deletions.
    7 changes: 0 additions & 7 deletions .bash_profile_or_.zshrc
    Original file line number Diff line number Diff line change
    @@ -1,7 +0,0 @@
    # Add the following to your shell init to set up gpg-agent automatically for every shell
    if [ -f ~/.gnupg/.gpg-agent-info ] && [ -n "$(pgrep gpg-agent)" ]; then
    source ~/.gnupg/.gpg-agent-info
    export GPG_AGENT_INFO
    else
    eval $(gpg-agent --daemon --write-env-file ~/.gnupg/.gpg-agent-info)
    fi
    6 changes: 0 additions & 6 deletions .gnupg_gpg-agent.conf
    Original file line number Diff line number Diff line change
    @@ -1,6 +0,0 @@
    # Enables GPG to find gpg-agent
    use-standard-socket

    # Connects gpg-agent to the OSX keychain via the brew-installed
    # pinentry program from GPGtools
    pinentry-program /usr/local/bin/pinentry-mac
    12 changes: 12 additions & 0 deletions .profile
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    # In order for gpg to find gpg-agent, gpg-agent must be running, and there must be an env
    # variable pointing GPG to the gpg-agent socket. This little script, which must be sourced
    # in your shell's init script (ie, .bash_profile, .zshrc, whatever), will either start
    # gpg-agent or set up the GPG_AGENT_INFO variable if it's already running.

    # Add the following to your shell init to set up gpg-agent automatically for every shell
    if [ -f ~/.gnupg/.gpg-agent-info ] && [ -n "$(pgrep gpg-agent)" ]; then
    source ~/.gnupg/.gpg-agent-info
    export GPG_AGENT_INFO
    else
    eval $(gpg-agent --daemon --write-env-file ~/.gnupg/.gpg-agent-info)
    fi
    8 changes: 8 additions & 0 deletions gpg-agent.conf
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    # Enables GPG to find gpg-agent
    use-standard-socket

    # Connects gpg-agent to the OSX keychain via the brew-installed
    # pinentry program from GPGtools. This is the OSX 'magic sauce',
    # allowing the gpg key's passphrase to be stored in the login
    # keychain, enabling automatic key signing.
    pinentry-program /usr/local/bin/pinentry-mac
    File renamed without changes.
    15 changes: 11 additions & 4 deletions setup-gpg
    Original file line number Diff line number Diff line change
    @@ -1,9 +1,16 @@
    # A quick outline of what must be done to get everything working.

    # 1) Install the dependencies.
    brew install gnupg gpg-agent pinentry-mac

    # Learn about creating a GPG key and the knowledge behind these commands here:
    # https://git-scm.com/book/en/v2/Git-Tools-Signing-Your-Work
    # 2) Configure git to automatically gpgsign commits. This consists of
    # pointing git to your signing key ID, and then enabling commit
    # automatic signing.
    git config --global user.signingkey <YOUR-SIGNING-KEY-PUB-ID>
    git config --global commit.gpgsign true

    # Don't forget to upload your keys to Github!
    # https://github.com/blog/2144-gpg-signature-verification
    # Don't forget to upload your public key to Github!
    # https://github.com/blog/2144-gpg-signature-verification

    # Learn about creating a GPG key and the knowledge behind these commands here:
    # https://git-scm.com/book/en/v2/Git-Tools-Signing-Your-Work
  4. @bmhatfield bmhatfield created this gist Apr 6, 2016.
    7 changes: 7 additions & 0 deletions .bash_profile_or_.zshrc
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    # Add the following to your shell init to set up gpg-agent automatically for every shell
    if [ -f ~/.gnupg/.gpg-agent-info ] && [ -n "$(pgrep gpg-agent)" ]; then
    source ~/.gnupg/.gpg-agent-info
    export GPG_AGENT_INFO
    else
    eval $(gpg-agent --daemon --write-env-file ~/.gnupg/.gpg-agent-info)
    fi
    6 changes: 6 additions & 0 deletions .gnupg_gpg-agent.conf
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,6 @@
    # Enables GPG to find gpg-agent
    use-standard-socket

    # Connects gpg-agent to the OSX keychain via the brew-installed
    # pinentry program from GPGtools
    pinentry-program /usr/local/bin/pinentry-mac
    2 changes: 2 additions & 0 deletions .gnupg_gpg.conf
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,2 @@
    # Uncomment within config (or add this line)
    use-agent
    9 changes: 9 additions & 0 deletions setup-gpg
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    brew install gnupg gpg-agent pinentry-mac

    # Learn about creating a GPG key and the knowledge behind these commands here:
    # https://git-scm.com/book/en/v2/Git-Tools-Signing-Your-Work
    git config --global user.signingkey <YOUR-SIGNING-KEY-PUB-ID>
    git config --global commit.gpgsign true

    # Don't forget to upload your keys to Github!
    # https://github.com/blog/2144-gpg-signature-verification