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

Still need help?

The Atlassian Community is here for you.

Ask the community

Symptoms

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

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:

    <?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:

    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:

    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.

Resolution

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

    <system.webServer>
        ...
        <httpErrors existingResponse="PassThrough"></httpErrors>
        ...
    </system.webServer>

    (info) For more information check Integrating JIRA with IIS.

Last modified on Mar 30, 2016

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.