Skip to main content

Atlassian Bitbucket Integration (formerly Stash)

2877784144.png

Bitbucket used to be a service similar to GitHub. One year ago, Atlassian has re-branded Stash (which is a Git daemon) and named it Bitbucket as well. It is important to notice, that Bitbucket service and Bitbucket server are based on different software and varies by features and API. Atlassian's roadmap is working on reducing these gaps.

Background - GIT Protocols

Git has support in dumb and smart client protocols. Client without smart protocol support has become extinct, and the dumb protocol should be avoided for poor performance and security. When smart protocol cannot be used, then the Git daemon (either Git Server or Bitbucket) would gracefully degrade to the dumb protocol.

An Issue with Bitbucket Default Installation

By default, Bitbucket is installed with dumb protocol support disabled (post-receive hook doesn't create info/refs file).

By default, the windows Bitbucket will not include the libraries to support smart protocol. As a result, after a fresh windows installation of Git, Bitbucket and Checkmarx - defining a Bitbucket source would fail with an error such as:

 fatal: http://******:******@localhost:7990/projects/DEMO/repos/rep1/info/refs not valid: is this a git repository?

This error suggests that the dumb protocol cannot be used. It implicitly means that the smart protocol has failed as well.

Solution

Bitbucket server should be told where to find the Git libraries to support smart protocol. This can be done in one of the following two methods:

Method 1 (preferred)

  1. Create or update the Bitbucket properties file %BITBUCKET_HOME%\shared\bitbucket.properties

  2. Enter a line showing where the git core lib path is. See an example for a typical Git installation below:

  plugin.bitbucket-git.path.libexec="c:\Program Files\Git\mingw64\libexec\git-core"

Method 2

  • Define the machine PATH to the GIT core lib