Bitbucket Server integration with Sourcegraph

You can use Sourcegraph with Git repositories hosted on Bitbucket Server (and the Bitbucket Data Center deployment option).

Feature Supported?
Repository syncing
Repository permissions
Sourcegraph native code intelligence plugin
Browser extension

Repository syncing

Site admins can add Bitbucket Server repositories to Sourcegraph.

Repository permissions

Site admins can configure Sourcegraph to respect Bitbucket Server's repository access permissions.

Sourcegraph native code intelligence plugin

Bitbucket Server code intelligence

We recommend installing the Sourcegraph Bitbucket Server plugin so each user doesn't need to install and configure the browser extension.

This involves adding a new add-on to your Bitbucket Server instance and see the bitbucket-server-plugin repository for installation instructions and configuration settings.

{
  // ...
  "corsOrigin":
    "https://my-bitbucket.example.com"
  // ...
}

Experimental Faster ACL permissions fetching

The plugin also supports an experimental method of faster ACL permissions fetching that aims to improve search speed. You can enable this in the experimental section of the site configuration:

{
  // ...
  "experimentalFeatures": {
    "bitbucketServerFastPerm": "enabled"
  }
  // ...
}

The speed improvements are subtle and more noticable for larger instances with thousands of repositories. This may remove the occasional slow search that has incurred the overhead of refreshing expired permissions information.

Browser extension

The Sourcegraph browser extension supports Bitbucket Server. When installed in your web browser, it adds hover tooltips, go-to-definition, find-references, and code search to files and pull requests viewed on Bitbucket Server.

  1. Install the Sourcegraph browser extension.
  2. Configure the browser extension to use your Sourcegraph instance.
  3. To allow the browser extension to work on your Bitbucket Server instance:
    • Navigate to any page on Bitbucket Server.
    • Right-click the Sourcegraph icon in the browser extension toolbar.
    • Click "Enable Sourcegraph on this domain".
    • Click "Allow" in the permissions request popup.
  4. Visit any file or pull request on Bitbucket Server. Hover over code or click the "View file" and "View repository" buttons.