Linking SourceTree to Stash: The Certificate for This Server Is Invalid

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

Problem

SourceTree is trying to link to a Stash instance that is using a self-signed SSL certificate. Stash Git repositories themselves have been set to be clone-able by setting setenv GIT_SSL_NO_VERIFY 1 in /etc/launchd.conf.

Also the public key for the self-signed certificate is present and trusted within the Mac OS X Keychain. As SourceTree's "Hosted Accounts" feature is used to link to the Stash instance, this does not seem to work due to a certificate trust issue. The following error message is displayed:

1 2 Stash API Call Failed The certificate for this server is invalid. You might be connecting to a server that is pretending to be "stash.xxxxxx.com" which could put your confidential information at risk.

If the application is run from a command line to perform this step, the following error message is displayed in the terminal window:

1 2012-05-10 12:35:03.162 SourceTree[9209:60b] Stash call failed: Error Domain=SDNetDomain Code=3 "Connection returned NULL data" UserInfo=0x4004e7da0 {NSLocalizedDescription=Connection returned NULL data, NSUnderlyingError=0x40082c600 "The certificate for this server is invalid. You might be connecting to a server that is pretending to be "stash.xxxxxx.com" which could put your confidential information at risk."}

Cause

The certificate is self-signed and therefore not automatically trusted by the system.

Resolution

This self-signed certificate must be explicitly trusted. Details of how to do this can be found in the following guide: Resolving SSL Self-Signed Certificate Errors

Updated on April 8, 2025

Still need help?

The Atlassian Community is here for you.