How to get a list of repository forks in Bitbucket Server and Data Center

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 content on this page relates to platforms which are not supported. Consequently, Atlassian Support cannot guarantee providing any support for it. Please be aware that this material is provided for your information only and using it is done so at your own risk.

This article explains how to get a list of repositories that are forks together with the repositories from which they originate.

Environment

Bitbucket 8.11, but also applicable to other versions.

Solution

The following database query provides a list of repositories that are forks together with repositories from which they originate.

  • Using database queries:

    • The first four columns are related to the repository forked from others.

    • The last four columns are related to the original repository that is forked from.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 -- list of repositories with forks select         p.project_key project,         p."name" project_name,         p.project_type project_private,         r.slug repo,         --         po.project_key fork_of_project,         po."name" fork_of_project_name,         po.project_type fork_of_project_private,         ro.slug fork_of_repo     from sta_repo_origin sro     join repository r on r.id = sro.repository_id     join project p on p.id = r.project_id     join repository ro on ro.id = sro.origin_id     join project po on po.id = ro.project_id     order by         p.project_key,         r.slug;
1 2 3 curl --request GET \ --url 'http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/forks' \ --header 'Accept: application/json;charset=UTF-8'
(Auto-migrated image: description temporarily unavailable)
Updated on April 8, 2025

Still need help?

The Atlassian Community is here for you.