Skip to content

Instantly share code, notes, and snippets.

@asears
Forked from alopresto/gpg_git_signing.md
Last active April 9, 2020 11:23
Show Gist options
  • Select an option

  • Save asears/2e609ad9bae913b6f6472b5c6b29b13f to your computer and use it in GitHub Desktop.

Select an option

Save asears/2e609ad9bae913b6f6472b5c6b29b13f to your computer and use it in GitHub Desktop.

Revisions

  1. asears revised this gist Apr 9, 2020. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions gpg_git_signing.md
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,5 @@
    On windows, git config --global gpg.program "C:\Program Files (x86)\GnuPG\bin\gpg.exe"

    If anyone is interested in setting up their system to automatically (or manually) sign their git commits with their GPG key, here are the steps:

    1. Generate and [add your key to GitHub](https://help.github.com/articles/adding-a-new-gpg-key-to-your-github-account/)
  2. @alopresto alopresto revised this gist Apr 22, 2016. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions gpg_git_signing.md
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,6 @@
    If anyone is interested in setting up their system to automatically (or manually) sign their git commits with their GPG key, here are the steps:

    1. Generate and [add your key to GitHub](https://help.github.com/articles/adding-a-new-gpg-key-to-your-github-account/)
    1. `$ git config --global commit.gpgsign true` ([OPTIONAL] every commit will now be signed)
    1. `$ git config --global user.signingkey ABCDEF01` (where `ABCDEF01` is the fingerprint of the key to use)
    1. `$ git config --global alias.logs "log --show-signature"` (now available as `$ git logs`)
  3. @alopresto alopresto revised this gist Apr 22, 2016. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions gpg_git_signing.md
    Original file line number Diff line number Diff line change
    @@ -22,6 +22,8 @@ no-tty

    If you perform git commits through SourceTree and want them to be signed, open `Preferences > General` and ensure that the `GPG Program` field has the value set to the directory containing the `gpg2` executable, for example `/usr/local/MacGPG2/bin`. Even if your `gpg` executable is version 2, the `gpg2` executable must be present.

    Then click the `Settings` icon at the top right of a repository window, click the `Security` icon, and check "Enable GPG key signing for commits" and select the desired key. If you have a `default-key` setting in `~/.gnupg/gpg.conf`, this should be correctly populated already.

    ## Resources

    * https://youtrack.jetbrains.com/issue/IDEA-110261#comment=27-1388832
  4. @alopresto alopresto revised this gist Apr 22, 2016. 1 changed file with 13 additions and 0 deletions.
    13 changes: 13 additions & 0 deletions gpg_git_signing.md
    Original file line number Diff line number Diff line change
    @@ -9,6 +9,19 @@ If anyone is interested in setting up their system to automatically (or manually
    1. `$ git cis -m "This commit is signed by a GPG key."` (regular `commit` will work if global signing is enabled)
    1. `$ git logs`

    ## IntelliJ IDEA Integration

    If you perform git commits through IntelliJ and want them to be signed, add the following line to your `~/.gnupg/gpg.conf` file:

    ```
    # This option tells gpg not to expect a TTY interface and allows IntelliJ to sign commits
    no-tty
    ```

    ## Atlassian SourceTree Integration

    If you perform git commits through SourceTree and want them to be signed, open `Preferences > General` and ensure that the `GPG Program` field has the value set to the directory containing the `gpg2` executable, for example `/usr/local/MacGPG2/bin`. Even if your `gpg` executable is version 2, the `gpg2` executable must be present.

    ## Resources

    * https://youtrack.jetbrains.com/issue/IDEA-110261#comment=27-1388832
  5. @alopresto alopresto revised this gist Apr 22, 2016. 1 changed file with 6 additions and 6 deletions.
    12 changes: 6 additions & 6 deletions gpg_git_signing.md
    Original file line number Diff line number Diff line change
    @@ -11,9 +11,9 @@ If anyone is interested in setting up their system to automatically (or manually

    ## Resources

    https://youtrack.jetbrains.com/issue/IDEA-110261#comment=27-1388832
    https://github.com/blog/2144-gpg-signature-verification
    https://help.github.com/articles/signing-commits-using-gpg/
    https://unix.stackexchange.com/questions/48862/how-can-i-create-an-alias-for-a-git-action-command-which-includes-spaces
    https://mikegerwitz.com/papers/git-horror-story
    https://blog.erincall.com/p/signing-your-git-commits-with-gpg
    * https://youtrack.jetbrains.com/issue/IDEA-110261#comment=27-1388832
    * https://github.com/blog/2144-gpg-signature-verification
    * https://help.github.com/articles/signing-commits-using-gpg/
    * https://unix.stackexchange.com/questions/48862/how-can-i-create-an-alias-for-a-git-action-command-which-includes-spaces
    * https://mikegerwitz.com/papers/git-horror-story
    * https://blog.erincall.com/p/signing-your-git-commits-with-gpg
  6. @alopresto alopresto created this gist Apr 22, 2016.
    19 changes: 19 additions & 0 deletions gpg_git_signing.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    If anyone is interested in setting up their system to automatically (or manually) sign their git commits with their GPG key, here are the steps:

    1. `$ git config --global commit.gpgsign true` ([OPTIONAL] every commit will now be signed)
    1. `$ git config --global user.signingkey ABCDEF01` (where `ABCDEF01` is the fingerprint of the key to use)
    1. `$ git config --global alias.logs "log --show-signature"` (now available as `$ git logs`)
    1. `$ git config --global alias.cis "commit -S"` (optional if global signing is false)
    1. `$ echo "Some content" >> example.txt`
    1. `$ git add example.txt`
    1. `$ git cis -m "This commit is signed by a GPG key."` (regular `commit` will work if global signing is enabled)
    1. `$ git logs`

    ## Resources

    https://youtrack.jetbrains.com/issue/IDEA-110261#comment=27-1388832
    https://github.com/blog/2144-gpg-signature-verification
    https://help.github.com/articles/signing-commits-using-gpg/
    https://unix.stackexchange.com/questions/48862/how-can-i-create-an-alias-for-a-git-action-command-which-includes-spaces
    https://mikegerwitz.com/papers/git-horror-story
    https://blog.erincall.com/p/signing-your-git-commits-with-gpg