Search code examples
restrepositorybitbucketbitbucket-server

How to extract the list of all repositories in Stash or Bitbucket?


I need to extract the list of all repos under all projects in Bitbucket. Is there a REST API for the same? I couldn't find one.

I have both on-premise and cloud Bitbucket.


Solution

  • For Bitbucket Cloud

    You can use their REST API to access and perform queries on your server.

    Specifically, you can use this documentation page, provided by Atlassian, to learn how to list you're repositories.


    For Bitbucket Server

    Edit: As of receiving this tweet from Dan Bennett, I've learnt there is an API/plugin system for Bitbucket Server that could possibly cater for your needs. For docs: See here.

    Edit2: Found this reference to listing personal repositories that may serve as a solution.

    AFAIK there isn't a solution for you unless you built a little API for yourself that interacted with your Bitbucket Server instance.

    Atlassian Documentation does indicate that to list all currently configured repositories you can do git remote -v. However I'm dubious of this as this isn't normally how git remote -v is used; I think it's more likely that Atlassian's documentation is being unclear rather than Atlassian building in this functionality to Bitbucket Server.