How to obtain a list of all projects and repositories from Bitbucket database
Platform Notice: Server and Data Center Only - This article only applies to Atlassian products on the server and data center platforms.
Whenever you have too many projects and too many repositories configured in the instance, having a better picture of how many of each you have can become challenging.
The purpose of this article is to help anybody that needs to retrieve a list of projects and repositories, along with personal repositories, directly from the database used by Bitbucket Server.
Advanced repository management available in Bitbucket Data Center 7.13
In 7.13, Bitbucket introduced Advanced repository management allowing you to more easily manage all of the repositories in your instance from the Repositories page in the Administration area.
- Connect to the database used by Bitbucket Server using the database vendor supplied tool or maybe using a client like DBVisualizer.
Run the following SQL query:
SELECT prj.name AS "Project / User Name" , prj.project_key AS "Project / User Key" , rep.name AS "Repository Name" , rep.slug AS "Repository Slug" FROM repository rep INNER JOIN project prj ON rep.project_id = prj.id ORDER BY prj.name, rep.name
Project / User Name Project / User Key Repository Name Repository Slug ------------------- ------------------ --------------- --------------- Project PROJ Temp1 temp1 Project Two PT GitHook githook ~internal1 ~INTERNAL1 PersonalRepo personalrepo
Project Onehas one repositories, named
Project Twohas one repository, named
internal1has a personal repository, named