Cannot clone nor push with http://username@bitbucket:7990/scm

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

Symptoms

While running Bitbucket Server connected to JIRA User Directory, it is not possible to clone nor push in the following combination:

1 git clone http://username@bitbucket:7990/scm/ACME/acmerepo.git

Diagnosis

To simulate the request that Bitbucket Server is making to JIRA and see what JIRA is returning:

  1. Create a file named "post-data" with the following contents:

    1 2 3 4 <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <password> <value></value> </password>
  2. Run the following cURL command (from the directory where the file was created) with <application-name> and <application-password> replaced with the application name and application password that Bitbucket Server is using to connect to JIRA as a user directory:

    1 curl -v -X POST -H "Accept: application/xml" -H "Content-Type: application/xml" -u <application-name>:<application-password> https://www.acme.com/jira/rest/usermanagement/1/authentication?username=bbunny --data @post-data
  3. If JIRA is integrated with IIS, the response should contain something like:

    1 2 3 Server: Microsoft-IIS/7.5 ... X-Powered-By: ASP.NET

Cause

JIRA uses a 400 response code with a specific message in the body to indicate to Bitbucket Server that authentication for a particular user has failed. In this case the response body and content-type are being mangled by IIS behavior.

This causes Bitbucket Server to mis-parse the response from JIRA and fall over with a 500 error on the client.

Solution

Resolution

  • Edit the web.config system.webServer section and set httpErrors existingResponse attribute to "PassThrough":

    1 2 3 4 5 <system.webServer> ... <httpErrors existingResponse="PassThrough"></httpErrors> ... </system.webServer>

    ℹ️ For more information check Integrating JIRA with IIS.

Updated on April 2, 2025

Still need help?

The Atlassian Community is here for you.