Identifying a repository's ID in Bitbucket Server

Still need help?

The Atlassian Community is here for you.

Ask the community


Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.

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 Bitbucket Server repositories are located in BITBUCKET_HOME/shared/data/repositories/<repository-id> but which ID corresponds to which repository?

Cause

Repositories are stored in Bitbucket Server's file system using a unique ID number instead of their name. 

Resolution

The System Administrator permission is required to see the location on disk of the repository.

To determine the storage location of a repository, navigate to the repository in Bitbucket Server and select Settings. The location on disk will be displayed under Repository details. The numerical part of the path is the ID of the repository.

If you have access to the database.

Bulk Repository ID

If you have a few repositories, run a query to the Bitbucket Server database for the ID numbers similar to : 

SELECT name, id FROM <DataBase>.repository; 

This query will list all repositories and corresponding ID's.  If you have a lot of repositories or need more details you need to identify the repository you can run: 

SELECT r.NAME,
       r.id,
       r.slug,
       p.project_key
FROM   repository r
       JOIN project p
         ON r.project_id = p.id
WHERE  r.id = <Pathid>;

This query will list all repositories, their project keys, and corresponding ID's.


If you only have access to the repository on the file system, the ID is in the path. The repository name and project is included in the repository-config file found in the root of the repository.  Here is an example:

#>***********************************************
# THIS FILE IS MAINTAINED BY ATLASSIAN BITBUCKET
# IT CONTAINS NO USER-SERVICEABLE PARTS.
#>***********************************************
[bitbucket]
	hierarchy = 511398e6633cd8d5803d
	project = TEST
	repository = test



Last modified on Feb 17, 2024

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.