SourceTree commits fail when using Git signed commits

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

Problem

SourceTree is not able to commit a change due to the impossibility to sign it.

The following appears in the SourceTree user interface.

1 2 3 4 gpg: cannot open `/dev/tty': Device not configured error: gpg failed to sign the data fatal: failed to write commit object

As shown on the following screenshot.

(Auto-migrated image: description temporarily unavailable)

Diagnosis

Diagnostic Steps

  • Check the git command in the SourceTree user interface

  • The git command does not contain any neither the --gpg.program nor the --gpg-sign command line option

Cause

This error occurs when the System Git or the repository has been configured outside of SourceTree to sign all commits, but SourceTree isn't. In this circumstance SourceTree just invokes the System Git instance which attempts to open a dialog with the user. However this is impossible when running within SourceTree.

Solution

Resolution

Setup GPG to sign commits within SourceTree so that the Git commit command line options are added by SourceTree when performing a commit.

Updated on April 2, 2025

Still need help?

The Atlassian Community is here for you.