Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,295,631
Community Members
 
Community Events
165
Community Groups

How do I find a bitbucket repo name from its numeric ID?..

We can find which repo corresponds to the numeric ID on disk from this:
https://confluence.atlassian.com/stashkb/identifying-a-repository-on-the-stash-server-292651201.html
but how do we find the repo name,  ie. the other way around?..

Thanks,
Sean

1 answer

2 votes
Jeff Thomas Atlassian Team Apr 24, 2017

Hi Sean,

If you're running Bitbucket Server 4.12+, this information is included in the repository-config file found in the root of the repository. For example, the contents of the file include:

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

This improvement was tracked at https://jira.atlassian.com/browse/BSERV-3972

If you haven't upgraded to to 4.12 yet, you can run the following database query to get the information:

SELECT *
FROM repository
JOIN project ON project.id = repository.project_id
WHERE repository.id = 1;

Cheers,
Jeff

Thanks for that.
We are running 4.8.2.
I couldn't find that particular file but the ticket says
data/repositories/1/config (for example)

So, for us it shows:

[core]
repositoryformatversion = 0
filemode = true
bare = true
packedgitlimit = 256m
packedgitwindowsize = 32m
[http]
receivepack = true
[gc "stash-refs/pull-requests/*"]
reflogExpire = never
reflogExpireUnreachable = never
[stash]
hierarchyid = 4d84f350b24a685b122c



 



 

 

Jeff Thomas Atlassian Team Apr 26, 2017

Hi Sean,

The repository-config file won't exist until you're running at least 4.12. Since you're on 4.8, the DB query should give you the information you're after.

Hi @Jeff Thomas ,

From the repositoryId, is there a way to get the repository name using a Bitbucket REST API?

Thanks,

Mary

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket

Git push size limits are coming to Bitbucket Cloud starting April 4th, 2022

Beginning on April 4th, we will be implementing push limits. This means that your push cannot be completed if it is over 3.5 GB. If you do attempt to complete a push that is over 3.5 GB, it will fail...

2,170 views 2 9
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you