Unable to connect to Bitbucket Server
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
The following appears when trying to clone the repository in Bitbucket Server:
fatal: http://user@example.com:7990/scm/PROJECT/repo.git/info/refs not valid: is this a git repository?
Diagnosis
Certain combinations of git and libcurl don't cope with the response body Bitbucket Server used to return up to version 2.0.3.
GIT Version | Curl version | Works? |
---|---|---|
<= 1.7.12.2 | 7.19.7 | YES |
1.7.12.3 | 7.19.7 | NO |
1.8.0.2 | 7.19.7 | NO |
1.7.12.3 | 7.28.1 | YES |
1.8.0.2 | 7.28.1 | YES |
This seems to particularly affect CentOS which ships with somewhat old versions of libcurl. E.g. CentOS 6.3 with curl-devel-7.19.7; CentOS 5.8 with curl-devel-7.15.5.
Cause
This is a combination of behaviour in Bitbucket Server BSERV-2966 - Shouldn't supply a response body to Git clients when returning 401 response with certain combinations of git and curl.
Solution
Workaround
Use a version of git that is known to work or compile git against a more recent version of libcurl.
Libcurl:
curl -OL http://curl.haxx.se/download/curl-7.28.1.tar.gz
tar xfz curl-7.28.1.tar.gz
cd curl-7.28.1
./configure --enable-http --prefix=/opt/curl-7.28.1
make
sudo make install
Git:
make configure
./configure --prefix=/opt/git-1.8.0.2 --with-curl=/opt/curl-7.28.1
make
sudo make install
Solution
Upgrade to Bitbucket Server 2.0.3+, which has fixed the bug.
Was this helpful?