Identifying a repository's ID in Bitbucket Server

Still need help?

The Atlassian Community is here for you.

Ask the community

Symptoms

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, there 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 Oct 12, 2021

Was this helpful?

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