Setup GPG to sign commits within SourceTree

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

This page aims to explain how to setup GPG to sign commits within SourceTree.

Solution

  • Install GPGTools https://gpgtools.org

  • Create or import a GPG key

    • SourceTree Only

      • Open the Repository/Repository Settings dialog

        (Auto-migrated image: description temporarily unavailable)
      • Open the Security tab

        1. Check "Enable GPG key signing for commits"

        2. Select your preferred key.

          (Auto-migrated image: description temporarily unavailable)
      • When next committing, check the "Sign Commit" "Commit Option"

        (Auto-migrated image: description temporarily unavailable)
    • Command line Git

  • Check that the commits are now signed

    • If SourceTree is correctly configured to sign commits, when committing a file you see the following screens:

      (Auto-migrated image: description temporarily unavailable)
      (Auto-migrated image: description temporarily unavailable)

      The -c gpg.program=/Applications/SourceTree.app/Contents/Resources/bin/stgpg.sh commit -q --gpg-sign=FAE3579EEA1C6363 command line options identify a signed Git commit:

      1 git -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sourcetree -c gpg.program=/Applications/SourceTree.app/Contents/Resources/bin/stgpg.sh commit -q --gpg-sign=FAE3579EEA1C6363 -F /var/folders/jw/5wfdcdr137q_hh1jw5nzcyvw0000gp/T/SourceTreeTemp.LiStAR

Updated on April 3, 2025

Still need help?

The Atlassian Community is here for you.