Wrong Git Clone URL When Using Proxy

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

Symptoms

When accessing a repository, the Git clone URL (default URL) should use the Bitbucket Server URL (example: http://localhost:7990):

1 git clone http://USER@127.0.0.1:7990/git/PROJECT/REPOSITORY.git

This is not the case when Bitbucket Server is behind a proxy.

Cause

The proxy is translating the URL to a local URL, so Bitbucket Server uses that address to show the clone URL.

Resolution

Bitbucket Server 5.0+

Configure the appropriate proxy settings (proxy-name, proxy-port, etc) in bitbucket.properties as mentioned in Proxy and secure Bitbucket.

Bitbucket Server 4.x

Update the connector settings in

$BITBUCKET_HOME/shared/server.xml

file to reflect the proxy settings from:

1 2 3 4 5 6   <Connector port="7990" protocol="HTTP/1.1" connectionTimeout="20000" useBodyEncodingForURI="true" redirectPort="8443" compression="on" compressableMimeType="text/html,text/xml,text/plain,text/css,application/json,application/javascript,application/x-javascript"/>

To:

1 2 3 4 5 6 7 8   <Connector port="7990" protocol="HTTP/1.1" connectionTimeout="20000" useBodyEncodingForURI="true" redirectPort="8443" compression="on" proxyName="myproxy.company.com" proxyPort="PORT_NUMBER" compressableMimeType="text/html,text/xml,text/plain,text/css,application/json,application/javascript,application/x-javascript"/>

Restart Bitbucket Server.

Updated on April 8, 2025

Still need help?

The Atlassian Community is here for you.