How to obtain a list of all projects and repositories from Bitbucket database

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

プラットフォームについて: Server および Data Center のみ。この記事は、Server および Data Center プラットフォームのアトラシアン製品にのみ適用されます。

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.

*Fisheye および Crucible は除く

目的

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.
  • 次の SQL クエリを実行します。

    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
  • Sample result:

    Project / User Name  Project / User Key  Repository Name  Repository Slug  
    -------------------  ------------------  ---------------  ---------------  
    Project              PROJ                Temp1            temp1            
    Project Two          PT                  GitHook          githook          
    ~internal1           ~INTERNAL1          PersonalRepo     personalrepo     

    Where

    • Project Project One has one repositories, named Temp1.
    • Project Project Two has one repository, named GitHook.
    • User internal1 has a personal repository, named PersonalRepo.



最終更新日 2021 年 7 月 30 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.